Hi,

I think you are right!  I have to make warning when checking in because 
this may cause incompatible behavior for already installed other 
patterns. :-(

Iain Pople wrote:

> Hi,
> 
> 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
> 
> --
> Iain Pople
> Systems Programmer
> University of Melbourne
> 
> ------------------------------------------------------
> Mailman-Users mailing list
> Mailman-Users@python.org
> http://mail.python.org/mailman/listinfo/mailman-users
> Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
> Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
> Unsubscribe: 
> http://mail.python.org/mailman/options/mailman-users/tkikuchi%40is.kochi-u.ac.jp
> 
> Security Policy: 
> http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp
> 
> 
> 

-- 
Tokio Kikuchi, tkikuchi@ is.kochi-u.ac.jp
http://weather.is.kochi-u.ac.jp/

------------------------------------------------------
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp

Reply via email to