Update of /cvsroot/mailman/mailman/Mailman/Handlers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19935

Modified Files:
      Tag: Release_2_1-maint
        SpamDetect.py 
Log Message:
Fix bug in patch #1032434: You should accumulate subpart headers.
    (should have went out an intermediate code) :-<


Index: SpamDetect.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Handlers/SpamDetect.py,v
retrieving revision 2.3.2.2
retrieving revision 2.3.2.3
diff -u -d -r2.3.2.2 -r2.3.2.3
--- SpamDetect.py       9 Oct 2004 04:58:00 -0000       2.3.2.2
+++ SpamDetect.py       21 Mar 2005 04:40:20 -0000      2.3.2.3
@@ -102,21 +102,25 @@
                 # we've detected spam, so throw the message away
                 raise SpamDetected
     # Now do header_filter_rules
-    g = HeaderGenerator(StringIO())
-    g.flatten(msg)
-    headers = g.header_text()
     # TK: Collect headers in sub-parts because attachment filename
     #     extension may be a clue to possible virus/spam.
     # Check also 'X-List-Administrivia' header if the message was owner
     # notification. Held message may be attached and have matching header
     # which may cause infinite loop of holding.
     if msg.is_multipart() and not msg.get('x-list-administrivia',''):
+        headers = ''
         for p in msg.walk():
             g = HeaderGenerator(StringIO())
             g.flatten(p)
-    headers = g.header_text()
-    headers = re.sub('\n+', '\n', headers) # remove extra cr
-    headers = re.sub('\n\s', ' ', headers) # connect multiline
+            headers += g.header_text()
+    else:
+        # Only the top level header should be checked.
+        g = HeaderGenerator(StringIO())
+        g.flatten(msg)
+        headers = g.header_text()
+    # Now reshape headers (remove extra CR and connect multiline).
+    headers = re.sub('\n+', '\n', headers)
+    headers = re.sub('\n\s', ' ', headers)
     for patterns, action, empty in mlist.header_filter_rules:
         if action == mm_cfg.DEFER:
             continue

_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to