Irene killed my firewall/web server/mail sever, so I'm in the process of
recreating its setup with the current 4.9 release. I was running into a
problem with making smtp-vilter (installed from a package) work the way I
expected it to work. Specifically, the virus backend via clamav and the spam
backend via spam assassin worked fine but I could never get the attachment
backend to work. I kept getting the following message in maillog whenever I
sent an unwanted attachment:
Sep 2 12:54:52 mushmouth smtp-vilter[32388]: failed to replace message body
After banging my head for a couple of days (I did search google and the
mailing list without luck) I was able to trace the error message to line 1817
of engine.c:
if ((virus_strategy == STRATEGY_NOTIFY_RECIPIENT)
|| (error_strategy == STRATEGY_NOTIFY_RECIPIENT)
|| (spam_strategy == STRATEGY_NOTIFY_RECIPIENT)
|| (unwanted_strategy == STRATEGY_NOTIFY_RECIPIENT))
desc.xxfi_flags |= SMFIF_CHGBODY;
It turns out that for unwanted content, when smtp-vilter registers with
sendmail, it never sets the change body flag because STRATEGY_NOTIFY_RECIPIENT
is not an allowed strategy for unwanted content. I made the following change
then rebuilt and re-installed, and things seem to work as expected.
if ((virus_strategy == STRATEGY_NOTIFY_RECIPIENT)
|| (error_strategy == STRATEGY_NOTIFY_RECIPIENT)
|| (spam_strategy == STRATEGY_NOTIFY_RECIPIENT)
|| (unwanted_strategy == STRATEGY_MARK))
desc.xxfi_flags |= SMFIF_CHGBODY;
It seems like a bug to me, but then again the code is a bit complex and I
don't fully understand it. I was just wondering if anybody had any thoughts
about this "fix." I don't know if this will effect anything. Anyway, reading
code is very educational and I did learn a few things in the process.
Aaron