Some Milter applications log a warning that looks like
this:
sid-filter[36540]: WARNING: sendmail symbol 'i' not available
And they may insert a message header with "unknown-msgid" like
this:
X-SenderID: Sendmail Sender-ID Filter vx.y.z host.example.com <unknown-msgid>
This happens because some Milter applications expect that the
queue ID is known before the MTA accepts the MAIL FROM
(sender) command. Postfix, on the other hand, does not choose a
queue file name until after it accepts the first valid RCPT
TO (recipient) command. Postfix queue file names must be unique
across multiple directories, so the name can't be chosen before the
file is created. If multiple messages were to use the same queue
ID simultaneously, mail would be lost.
To work around the ugly message header from Milter applications,
we add a little code to the Milter source to look up the queue ID
after Postfix receives the end of the message.
dfc = cc->cctx_msg;
assert(dfc != NULL);
/* Determine the job ID for logging. */
if (dfc->mctx_jobid == 0 || strcmp(dfc->mctx_jobid, JOBIDUNKNOWN) == 0) {
char *jobid = smfi_getsymval(ctx, "i");
if (jobid != 0)
dfc->mctx_jobid = jobid;
}
/* get hostname; used in the X header and in new MIME boundaries */
NOTES:
-
Different mail filters use slightly different names for
variables. If the above code does not compile, look for the code
at the start of the mlfi_eoh() routine.
-
This fixes only the ugly message header, but not the WARNING
message. Fortunately, dk-filter logs that message only once.
With some Milter applications we can fix both the WARNING and
the "unknown-msgid" by postponing the call of mlfi_eoh()
(or whatever routine logs the WARNING) until the end of the message.
-
Edit the filter source file (typically named
sid-filter/sid-filter.c or similar).
-
Look up the smfilter table and replace
mlfi_eoh (or whatever routine logs the WARNING) by NULL.
-
Look up the mlfi_eom() function and add code near
the top that calls mlfi_eoh() as shown by the bold
text below:
assert(ctx != NULL);
#endif /* !DEBUG */
ret = mlfi_eoh(ctx);
if (ret != SMFIS_CONTINUE)
return ret;
This works with sid-milter-0.2.10. Other Milter applications
will dump core when you do this.