diff options
| -rw-r--r-- | Mailman/Bouncers/DSN.py | 8 | ||||
| -rw-r--r-- | Mailman/Bouncers/Netscape.py | 10 | ||||
| -rw-r--r-- | Mailman/Bouncers/Postfix.py | 6 |
3 files changed, 18 insertions, 6 deletions
diff --git a/Mailman/Bouncers/DSN.py b/Mailman/Bouncers/DSN.py index 086890d91..14ebc74cd 100644 --- a/Mailman/Bouncers/DSN.py +++ b/Mailman/Bouncers/DSN.py @@ -51,13 +51,17 @@ def process(msg): while 1: try: more = mfile.next() - except multifile.Error, e: + except multifile.Error: # the message *looked* like a DSN, but it really wasn't :( return None if not more: # we didn't find it return None - s = StringIO(mfile.read()) + try: + s = StringIO(mfile.read()) + except multifile.Error: + # It is a mis-formated or incomplete message + return None msg2 = mimetools.Message(s) if msg2.gettype() == 'message/delivery-status': # hmm, could there be more than one DSN per message? diff --git a/Mailman/Bouncers/Netscape.py b/Mailman/Bouncers/Netscape.py index ca1a8b9ce..1f89c7bf7 100644 --- a/Mailman/Bouncers/Netscape.py +++ b/Mailman/Bouncers/Netscape.py @@ -48,13 +48,17 @@ def process(msg): while 1: try: more = mfile.next() - except multifile.Error, e: - # the message *looked* like a DSN, but it really wasn't :( + except multifile.Error: + # Not properly formatted MIME return None if not more: # we didn't find it return None - s = StringIO(mfile.read()) + try: + s = StringIO(mfile.read()) + except multifile.Error: + # Not properly formatted MIME + return None msg = mimetools.Message(s) if msg.gettype() == 'message/delivery-status': break diff --git a/Mailman/Bouncers/Postfix.py b/Mailman/Bouncers/Postfix.py index 122ab30c7..61993d76a 100644 --- a/Mailman/Bouncers/Postfix.py +++ b/Mailman/Bouncers/Postfix.py @@ -43,7 +43,11 @@ def process(msg): if not more: # we didn't find it return None - s = StringIO(mfile.read()) + try: + s = StringIO(mfile.read()) + except multifile.Error: + # It is a mis-formated or incomplete message + return None msg2 = mimetools.Message(s) if msg2.gettype() == 'text/plain': desc = msg2.get('content-description') |
