Update of /cvsroot/mailman/mailman/Mailman/Handlers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2990/Handlers
Modified Files:
Tag: Release_2_1-maint
SpamDetect.py
Log Message:
[ 1032434 ] make KNOWN_SPAMMERS work for headers appearing mult. times
[ 1026977 ] check attachment header by SpamDetect.py
Index: SpamDetect.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Handlers/SpamDetect.py,v
retrieving revision 2.3.2.1
retrieving revision 2.3.2.2
diff -u -d -r2.3.2.1 -r2.3.2.2
--- SpamDetect.py 1 Dec 2003 01:49:54 -0000 2.3.2.1
+++ SpamDetect.py 9 Oct 2004 04:58:00 -0000 2.3.2.2
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2004 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -96,17 +96,27 @@
# First do site hard coded header spam checks
for header, regex in mm_cfg.KNOWN_SPAMMERS:
cre = re.compile(regex, re.IGNORECASE)
- value = msg[header]
- if not value:
- continue
- mo = cre.search(value)
- if mo:
- # we've detected spam, so throw the message away
- raise SpamDetected
+ for value in msg.get_all(header, []):
+ mo = cre.search(value)
+ if mo:
+ # 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',''):
+ 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
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