diff options
| author | bwarsaw | 2002-01-26 23:28:53 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-01-26 23:28:53 +0000 |
| commit | 934489a03705964deaff93d7d6428ee819fb4622 (patch) | |
| tree | 6f7e3e58dbec705fcb88d4c44c70755f245cf906 | |
| parent | 70b9d49c66ee15352ac97708ed33899b755c1aa6 (diff) | |
| download | mailman-934489a03705964deaff93d7d6428ee819fb4622.tar.gz mailman-934489a03705964deaff93d7d6428ee819fb4622.tar.zst mailman-934489a03705964deaff93d7d6428ee819fb4622.zip | |
dequeue(): Handle the case when the email package throws a
MessageParseError during parsing of the message. Most likely cause is
because of bad MIME encapsulation. /That's/ likely caused by the
message being a virus <wink>.
Disposition depends on QRUNNER_SAVE_BAD_MESSAGES. When true, the
message text is saved in qfiles/bad. When false, it is discarded. We
always log the error.
| -rw-r--r-- | Mailman/Queue/Switchboard.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Mailman/Queue/Switchboard.py b/Mailman/Queue/Switchboard.py index f0714dd80..a71d6c146 100644 --- a/Mailman/Queue/Switchboard.py +++ b/Mailman/Queue/Switchboard.py @@ -1,4 +1,4 @@ -# Copyright (C) 2001 by the Free Software Foundation, Inc. +# Copyright (C) 2001,2002 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 @@ -157,6 +157,22 @@ class _Switchboard: os.unlink(msgfile) except EnvironmentError, e: if e.errno <> errno.ENOENT: raise + except email.Errors.MessageParseError, e: + # This message was unparsable, most likely because its + # MIME encapsulation was broken. For now, there's not + # much we can do about it. + syslog('error', 'message is unparsable: %s', filebase) + msgfp.close() + msgfp = None + if mm_cfg.QRUNNER_SAVE_BAD_MESSAGES: + # Cheapo way to ensure the directory exists w/ the + # proper permissions. + sb = Switchboard(mm_cfg.BADQUEUE_DIR) + os.rename(msgfile, os.path.join( + mm_cfg.BADQUEUE_DIR, filebase + '.txt')) + else: + os.unlink(msgfile) + msg = data = None finally: if msgfp: msgfp.close() |
