I am using the Debian package version 0.45.4 of the Courier mail server,
using the amavisd-new virus scanner (with a patch I wrote myself) as a
global mail filter.

According to the courierfilter(8) manpage, mail is filtered only if its
source is listed in the enablefiltering configuration file.  However my
enablefiltering file contains only "esmtp" and mail originating locally is
still filtered:
[EMAIL PROTECTED]:~$ cat sample-virus-simple.txt | /usr/lib/sendmail [EMAIL PROTECTED]
550 5.7.1 Message content rejected, id=15013-3 - VIRUS: EICAR-AV-Test
sendmail: Unable to submit message.

Looking at courier/submit{,2}.C, it appears that the enablefiltering file is
used only to determine whether or not to run the rewrite library's filter
while no check is made when running the global filter as described in
courierfilter(8).  Perhaps the error lies in the documentation or my
understanding of it rather than in the code, but here's a patch to make the
code do what the manpage says:
diff -Naru courier.orig/submit.C courier/submit.C
--- courier.orig/submit.C       2004-06-17 13:00:47.000000000 +0100
+++ courier/submit.C    2004-06-17 13:00:53.000000000 +0100
@@ -1417,7 +1417,7 @@
                /* Make sure bounces go through */
 
                mf->flag=my_rcptinfo.submitfile.MessageEnd(my_rcptinfo.rcptnum,
-                       my_rcptinfo.whitelisted_only, mf->module->name);
+                       my_rcptinfo.whitelisted_only, !nofilter);
        }
 }
 
diff -Naru courier.orig/submit.h courier/submit.h
--- courier.orig/submit.h       2004-06-17 13:00:47.000000000 +0100
+++ courier/submit.h    2004-06-17 13:00:53.000000000 +0100
@@ -130,7 +130,7 @@
 
        void MessageStart();
        void Message(const char *);
-       int MessageEnd(unsigned, int, const char *);
+       int MessageEnd(unsigned, int, int);
 static CString get_msgid_for_filtering(unsigned, void *);
 
 static void interrupt();
diff -Naru courier.orig/submit2.C courier/submit2.C
--- courier.orig/submit2.C      2004-06-17 13:00:47.000000000 +0100
+++ courier/submit2.C   2004-06-17 13:00:53.000000000 +0100
@@ -812,7 +812,7 @@
 /* ------------ */
 
 int SubmitFile::MessageEnd(unsigned rcptnum, int iswhitelisted,
-                          const char *sending_module)
+                          int filter_enabled)
 {
 int    is8bit=0, dorewrite=0, rwmode=0;
 const  char *mime=getenv("MIME");
@@ -937,7 +937,7 @@
 
 SubmitFile *voidp=this;
 
-       if (strcmp(sending_module, "dsn") &&
+       if (filter_enabled &&
            run_filter(dfile, num_control_files_created,
                       iswhitelisted,
                       &SubmitFile::get_msgid_for_filtering, &voidp))

-- 
Martin Orr
Linux Administrator,
Methodist College Belfast


-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to