Package: spamass-milter Version: 0.3.0-1 Severity: minor Tags: patch Since loading spamass-milter, local users have complained that sending mail takes too long (spamass-milter is checking all their e-mail).
The -i flag doesn't cut it, as we have road-warriors. This patch adds a new -I flag, which, if added, will cause spamass-milter to ignore any mail sent by authenticated senders. PLEASE NOTE: While this patch has been tested, I have *NOT* confirmed that it does not cause a small memory leak in spamass-milter. I think it may be possible, I do not fully grok the flow of calls yet. Please review. I have also sent a copy of this patch on to Dan Nelson upstream for review. -- System Information: Debian Release: 3.1 APT prefers testing APT policy: (650, 'testing'), (600, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.10-1-686-smp Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Versions of packages spamass-milter depends on: ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an ii libgcc1 1:3.4.3-6 GCC support library ii libmilter0 8.13.3-6 Sendmail Mail Filter API (Milter) ii libstdc++5 1:3.3.5-8 The GNU Standard C++ Library v3 ii sendmail 8.13.3-6 powerful, efficient, and scalable ii spamc 3.0.2-1 Client for SpamAssassin spam filte -- no debconf information
--- spamass-milter.cpp 2005-02-04 23:03:22.000000000 -0800 +++ spamass-milter.cpp 2005-03-27 17:13:50.595882304 -0800 @@ -169,6 +169,7 @@ char *spambucket; bool flag_full_email = false; /* pass full email address to spamc */ bool flag_expand = false; /* alias/virtusertable expansion */ +bool ignore_authenticated_senders = false; #if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */ static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -180,7 +181,7 @@ main(int argc, char* argv[]) { int c, err = 0; - const char *args = "fd:mMp:P:r:u:D:i:b:B:e:x"; + const char *args = "fd:mMp:P:r:u:D:i:Ib:B:e:x"; char *sock = NULL; bool dofork = false; char *pidfilename = NULL; @@ -212,6 +213,10 @@ debug(D_MISC, "Parsing ignore list"); parse_networklist(optarg, &ignorenets); break; + case 'I': + debug(D_MISC, "Ignore authenticated senders"); + ignore_authenticated_senders = true; + break; case 'm': dontmodifyspam = true; smfilter.xxfi_flags &= ~SMFIF_CHGBODY; @@ -279,7 +284,7 @@ cout << PACKAGE_NAME << " - Version " << PACKAGE_VERSION << endl; cout << "SpamAssassin Sendmail Milter Plugin" << endl; cout << "Usage: spamass-milter -p socket [-b|-B bucket] [-d xx[,yy...]] [-D host]" << endl; - cout << " [-e defaultdomain] [-f] [-i networks] [-m] [-M]" << endl; + cout << " [-e defaultdomain] [-f] [-i networks] [-I] [-m] [-M]" << endl; cout << " [-P pidfile] [-r nn] [-u defaultuser] [-x]" << endl; cout << " [-- spamc args ]" << endl; cout << " -p socket: path to create socket" << endl; @@ -293,6 +298,7 @@ cout << " -f: fork into background" << endl; cout << " -i: skip (ignore) checks from these IPs or netblocks" << endl; cout << " example: -i 192.168.12.5,10.0.0.0/8,172.16/255.255.0.0" << endl; + cout << " -I: skip (ignore) checks if sender is authenticated" << endl; cout << " -m: don't modify body, Content-type: or Subject:" << endl; cout << " -M: don't modify the message at all" << endl; cout << " -P pidfile: Put processid in pidfile" << endl; @@ -761,6 +767,22 @@ struct context *sctx = (struct context *)smfi_getpriv(ctx); char *queueid; + if (ignore_authenticated_senders) + { + char *auth_authen; + + auth_authen = smfi_getsymval(ctx, "{auth_authen}"); + debug(D_MISC, "auth_authen=%s", auth_authen); + + if (auth_authen) + { + debug(D_MISC, "sender authenticated (%s) - accepting message", + auth_authen); + debug(D_FUNC, "mlfi_envfrom: exit ignore"); + return SMFIS_ACCEPT; + } + } + debug(D_FUNC, "mlfi_envfrom: enter"); try { // launch new SpamAssassin --- spamass-milter.1.in 2004-03-18 10:37:08.000000000 -0800 +++ spamass-milter.1.in 2005-03-27 20:23:09.552408021 -0800 @@ -14,6 +14,7 @@ .Op Fl e Ar defaultdomain .Op Fl f .Op Fl i Ar networks +.Op Fl I .Op Fl m .Op Fl M .Op Fl P Ar pidfile @@ -119,6 +120,8 @@ flags will append to the list. For example, if you list all your internal networks, no outgoing emails will be filtered. +.It Fl I +Ignores messages if the sender has authenticated via SMTP AUTH. .It Fl m Disables modification of the .Ql Subject: