Wednesday March 03, 2004 - Jeremy Kitchen Thanks to Charles Cazabon for the log3() function and associated code. This patch was created against stock qmail-1.03 + qmail-smtpd-viruscan-1.3.patch available from qmail.org. This only patches against the spankin new version of 1.3 of Russell's patch. He made a change to the line that is returned to the SMTP client when it rejects a message and that had to be reflected here. this is NOT for stock qmail, this is only to be patched against qmail with the qmail-smtpd-viruscan patch from Russell Nelson. You can find the most recent version of Russell's patch at: http://qmail.org/top.html#microsoft 3/3/2004 Jeremy Kitchen - kitchen at scriptkitchen dot com diff -urN qmail-1.03-viruscan.orig/qmail-smtpd.c qmail-1.03-viruscan/qmail-smtpd.c --- qmail-1.03-viruscan.orig/qmail-smtpd.c 2004-01-29 16:45:07.999961288 -0600 +++ qmail-1.03-viruscan/qmail-smtpd.c 2004-01-29 17:13:50.772060120 -0600 @@ -38,9 +38,15 @@ char ssoutbuf[512]; substdio ssout = SUBSTDIO_FDBUF(safewrite,1,ssoutbuf,sizeof ssoutbuf); +char sserrbuf[512]; +substdio sserr = SUBSTDIO_FDBUF(safewrite,2,sserrbuf,sizeof sserrbuf); void flush() { substdio_flush(&ssout); } void out(s) char *s; { substdio_puts(&ssout,s); } +void log3(s1,s2,s3) char *s1; char *s2; char *s3; { + substdio_putsflush(&sserr,s1); + substdio_putsflush(&sserr,s2); + substdio_putsflush(&sserr,s3); } void die_read() { _exit(1); } void die_alarm() { out("451 timeout (#4.4.2)\r\n"); flush(); _exit(1); } @@ -552,7 +558,8 @@ if (!*qqx) { acceptmessage(qp); return; } if (hops) { out("554 too many hops, this message is looping (#5.4.6)\r\n"); return; } if (databytes) if (!bytestooverflow) { out("552 sorry, that message size exceeds my databytes limit (#5.3.4)\r\n"); return; } - if (flagexecutable) { out("552 we don't accept email with such content (#5.3.4)\r\n"); return; } + if (flagexecutable) { out("552 we don't accept email with such content (#5.3.4)\r\n"); + log3("qmail-smtpd: unacceptable content rejected from ",remoteip,"\n"); return; } if (*qqx == 'D') out("554 "); else out("451 "); out(qqx + 1); out("\r\n");