Milter xxfi_unknown()

Handle unknown SMTP commands V8.14 and later

An unknown SMTP command is one that is either undefined by the standards, or currently not supported by the sendmail connecting to your Milter. In this case, the sendmail program always rejects unknown SMTP commands:

500 5.5.1 Command unrecognized: "bob's your uncle"

But beginning with V8.14, you may elect to access those unknown commands, and optionally change how they are rejected, by using this xxfi_unknown() function.

The xxfi_unknown() function is called like this:

sfsistat
xxfi_unknown(SMFICTX *ctx, char *badcmd)

Here, ctx is the context pointer passed to all xxfi_ functions to maintain state in a multithreaded environment. The badcmd is the literal bad text supplied to sendmail. It is a zero-terminated string. That text may be anything, including control and other characters, so be certain to practice defensive programming:

""
"^C"
"select * from passwd;"
"GET /"

This xxfi_unknown() function, if used, may be called multiple times during any given connection. The values the xxfi_unknown() function can return and their meanings are:

SMFIS_CONTINUE

Reject the unknown command in the normal manner. This is the default return value if you don’t declare an unknown-command handler in smfiDesc (Milter smfi_register() on page 1194).

SMFIS_REJECT

Reject the unknown command. This has the same effect as SMFIS_CONTINUE.

SMFIS_ACCEPT

This has the same effect as SMFIS_CONTINUE.

SMFIS_TEMPFAIL

Temp-fail the unknown command (with a 4yz SMTP ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.