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

SourceForge.net noreply at sourceforge.net
Wed Aug 3 01:12:18 CEST 2005


Bugs item #1250657, was opened at 2005-08-02 23:12
Message generated for change (Tracker Item Submitted) made by Item Submitter
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: Open
Resolution: None
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


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

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