From 45be4dc53dcdf39af119df62db458f948fa94911 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Fri, 4 Sep 2015 22:49:33 -0400 Subject: Don't decode bytes in smtpd. Pass them through to the email package so it can convert them from bytes to message objects. --- src/mailman/runners/lmtp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mailman/runners/lmtp.py b/src/mailman/runners/lmtp.py index 8a490d906..bd577803e 100644 --- a/src/mailman/runners/lmtp.py +++ b/src/mailman/runners/lmtp.py @@ -139,7 +139,7 @@ class Channel(smtpd.SMTPChannel): """An LMTP channel.""" def __init__(self, server, conn, addr): - super().__init__(server, conn, addr) + super().__init__(server, conn, addr, decode_data=False) # Stash this here since the subclass uses private attributes. :( self._server = server @@ -179,14 +179,14 @@ class LMTPRunner(Runner, smtpd.SMTPServer): slog.debug('LMTP accept from %s', addr) @transactional - def process_message(self, peer, mailfrom, rcpttos, data): + def process_message(self, peer, mailfrom, rcpttos, data, **kwargs): try: # Refresh the list of list names every time we process a message # since the set of mailing lists could have changed. listnames = set(getUtility(IListManager).names) # Parse the message data. If there are any defects in the # message, reject it right away; it's probably spam. - msg = email.message_from_string(data, Message) + msg = email.message_from_bytes(data, Message) except Exception: elog.exception('LMTP message parsing') config.db.abort() -- cgit v1.3.1