[ mailman-Bugs-1250657 ] header_filter_rules should use multiline mode

SourceForge.net noreply at sourceforge.net
Thu Aug 4 06:10:54 CEST 2005


Bugs item #1250657, was opened at 2005-08-02 23:12
Message generated for change (Comment added) made by tkikuchi
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100103&aid=1250657&group_id=103

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: security/privacy
Group: 2.1 (stable)
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Iain Pople (iainpople)
Assigned to: Nobody/Anonymous (nobody)
Summary: header_filter_rules should use multiline mode

Initial Comment:
I have noticed some unexpected behaviour with 
header_filter_rules.

I wanted to reject messages with an empty subject line so i came 
up with the following regex:

^subject:\s*$

However it wasn't working as desired. After delving around in the 
SpamDetect.py code i noticed that the re.search call is not using 
MULTILINE mode. So the headers are treated as one long string 
and ^ would only match the beginning of the string.

Is this the desired behaviour? To me it makes more sense that it 
should use multiline mode.

i.e.:

--- SpamDetect.py.bak   2005-08-02 15:56:42.083270000 +1000
+++ SpamDetect.py       2005-08-02 17:33:59.698226000 +1000
@@ -127,7 +127,7 @@
         for pattern in patterns.splitlines():
             if pattern.startswith('#'):
                 continue
-            if re.search(pattern, headers, re.IGNORECASE):
+            if re.search(pattern, headers, re.IGNORECASE|
re.MULTILINE):
                 if action == mm_cfg.DISCARD:
                     raise Errors.DiscardMessage
                 if action == mm_cfg.REJECT:
@@ -137,3 +137,4 @@
                     hold_for_approval(mlist, msg, msgdata, 
HeaderMatchHold)
                 if action == mm_cfg.ACCEPT:
                     return


----------------------------------------------------------------------

>Comment By: Tokio Kikuchi (tkikuchi)
Date: 2005-08-04 04:10

Message:
Logged In: YES 
user_id=67709

Thank you!  This was fixed in CVS.
There may be some incompatibilities with this fix but my
trivial example (in the Mailman FAQ Wizard 3.51) passed a test.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100103&aid=1250657&group_id=103


More information about the Mailman-coders mailing list