diff options
author | tkikuchi <> | 2005-03-21 04:40:20 +0000 |
---|---|---|
committer | tkikuchi <> | 2005-03-21 04:40:20 +0000 |
commit | 62d3da8bc26f08ff2aa4e9de6a5469e9c1dc55df (patch) | |
tree | a28ce0746add0f264f4c5dfffc8e416e771ff91e /Mailman | |
parent | 44e117a4eb6cdef75073ad2765ec481e6eb9cae6 (diff) | |
download | mailman2-62d3da8bc26f08ff2aa4e9de6a5469e9c1dc55df.tar.gz mailman2-62d3da8bc26f08ff2aa4e9de6a5469e9c1dc55df.tar.xz mailman2-62d3da8bc26f08ff2aa4e9de6a5469e9c1dc55df.zip |
Fix bug in patch #1032434: You should accumulate subpart headers.
(should have went out an intermediate code) :-<
Diffstat (limited to 'Mailman')
-rw-r--r-- | Mailman/Handlers/SpamDetect.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Mailman/Handlers/SpamDetect.py b/Mailman/Handlers/SpamDetect.py index 38d7f24d..68fbf931 100644 --- a/Mailman/Handlers/SpamDetect.py +++ b/Mailman/Handlers/SpamDetect.py @@ -102,21 +102,25 @@ def process(mlist, msg, msgdata): # 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 |