changeset 230:ad38575e98ca

Prevent auto whitelisting due to outgoing multipart/report delivery notifications.
author Carl Byington <carl@five-ten-sg.com>
date Fri, 08 May 2009 12:55:30 -0700
parents b3652d1ae010
children 4d6bd04d93fa
files ChangeLog NEWS configure.in dnsbl.spec.in src/dnsbl.cpp src/dnsbl.h
diffstat 6 files changed, 63 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Feb 07 11:31:59 2009 -0800
+++ b/ChangeLog	Fri May 08 12:55:30 2009 -0700
@@ -1,3 +1,7 @@
+6.22 2009-05-08
+    Prevent auto whitelisting due to outgoing multipart/report
+    delivery notifications.
+
 6.21 2009-01-03
     Fixes to compile on old systems without memrchr or string::clear().
     Fix bug in spamassassin interface trying to clear a string with
--- a/NEWS	Sat Feb 07 11:31:59 2009 -0800
+++ b/NEWS	Fri May 08 12:55:30 2009 -0700
@@ -1,3 +1,4 @@
+6.22 2009-05-08 Prevent auto whitelisting due to outgoing multipart/report delivery notifications.
 6.21 2009-01-03 Fixes to compile on old systems without memrchr or string::clear().
 6.20 2008-12-27 Never whitelist self addressed mail.
 6.19 2008-06-10 Fixes to compile on Fedora 9 and for const correctness.
--- a/configure.in	Sat Feb 07 11:31:59 2009 -0800
+++ b/configure.in	Fri May 08 12:55:30 2009 -0700
@@ -1,6 +1,6 @@
 
 AC_PREREQ(2.59)
-AC_INIT(dnsbl,6.21,carl@five-ten-sg.com)
+AC_INIT(dnsbl,6.22,carl@five-ten-sg.com)
 AC_CONFIG_SRCDIR([config.h.in])
 AC_CONFIG_HEADER([config.h])
 
--- a/dnsbl.spec.in	Sat Feb 07 11:31:59 2009 -0800
+++ b/dnsbl.spec.in	Fri May 08 12:55:30 2009 -0700
@@ -96,6 +96,10 @@
 
 
 %changelog
+* Fri May 08 2009 Carl Byington <carl@five-ten-sg.com> - 6.22-1
+- Prevent auto whitelisting due to outgoing multipart/report
+  delivery notifications.
+
 * Sat Jan 03 2009 Carl Byington <carl@five-ten-sg.com> - 6.21-1
 - Fixes to compile on old systems without memrchr or string::clear().
 - Fix bug in spamassassin interface trying to clear a string with string::empty().
--- a/src/dnsbl.cpp	Sat Feb 07 11:31:59 2009 -0800
+++ b/src/dnsbl.cpp	Fri May 08 12:55:30 2009 -0700
@@ -271,7 +271,7 @@
     want_spamassassin   = false;
     want_dccgrey        = false;
     want_dccbulk        = false;
-    is_bulk_precedence  = false;
+    allow_autowhitelisting  = true;
     content_context     = NULL;
     memory              = NULL;
     scanner             = NULL;
@@ -323,7 +323,7 @@
         want_spamassassin   = false;
         want_dccgrey        = false;
         want_dccbulk        = false;
-        is_bulk_precedence  = false;
+        allow_autowhitelisting  = true;
         content_context     = NULL;
         memory              = NULL;
         scanner             = NULL;
@@ -1177,8 +1177,11 @@
 {
     mlfiPriv &priv = *MLFIPRIV;
     // detect precedence:bulk for avoiding autowhitelisting
-    if ((strcasecmp(headerf, "precedence") == 0) &&
-        (strcasecmp(headerv, "bulk") == 0)) priv.is_bulk_precedence = true;
+    if (((strcasecmp(headerf, "precedence") == 0)   && (strcasecmp(headerv, "bulk") == 0)) ||
+        ((strcasecmp(headerf, "content-type") == 0) && (strncasecmp(headerv, "multipart/report", 16) == 0))) {
+        priv.allow_autowhitelisting = false;
+    }
+
     // other headers are only needed for content filtering
     if (priv.authenticated)     return SMFIS_CONTINUE;
     if (priv.only_whites)       return SMFIS_CONTINUE;
@@ -1193,7 +1196,7 @@
     // delayed autowhitelisting
     while (!priv.delayer.empty()) {
         DELAYWHITEP dwp = priv.delayer.front();
-        if (!priv.is_bulk_precedence) {
+        if (priv.allow_autowhitelisting) {
             const char   *loto = dwp->get_loto();
             WHITELISTERP w     = dwp->get_w();
             CONTEXTP     con2  = dwp->get_con();
--- a/src/dnsbl.h	Sat Feb 07 11:31:59 2009 -0800
+++ b/src/dnsbl.h	Fri May 08 12:55:30 2009 -0700
@@ -44,7 +44,7 @@
     bool            want_spamassassin;      // at least one non-whitelisted recipient has a non zero spamassassin limit
     bool            want_dccgrey;           // at least one non-whitelisted recipient wants dcc greylisting
     bool            want_dccbulk;           // at least one non-whitelisted recipient wants dcc bulk filtering
-    bool            is_bulk_precedence;     // have precedence:bulk header to prevent autowhitelisting
+    bool            allow_autowhitelisting; // precedence:bulk or content-type:multipart/report headers prevent autowhitelisting
     delay_whitelist delayer;                // to remember autowhitelisting until we see headers
     CONTEXT         *content_context;       // first non-whitelisted recipient with a content filtering context
     context_map     env_to;                 // map each non-whitelisted recipient to their filtering context