diff options
| author | Barry Warsaw | 2015-09-04 22:49:33 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2015-09-04 22:49:33 -0400 |
| commit | dd3b09190a7f34108ad43b66daac807a8b4d899a (patch) | |
| tree | 001b9fa24dfef57108fa4666914036633cac88bc /src | |
| parent | 14faa52431f4d5a5c3ac11997d20a7feb82e7b0c (diff) | |
| download | mailman-dd3b09190a7f34108ad43b66daac807a8b4d899a.tar.gz mailman-dd3b09190a7f34108ad43b66daac807a8b4d899a.tar.zst mailman-dd3b09190a7f34108ad43b66daac807a8b4d899a.zip | |
Don't decode bytes in smtpd. Pass them through to the email package so it can
convert them from bytes to message objects.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/runners/lmtp.py | 6 |
1 files changed, 3 insertions, 3 deletions
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() |
