Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: cb683771 by Mark Sapiro at 2021-05-20T15:12:15-07:00 Set unixfrom in LMTP runner. - - - - - a1c11362 by Mark Sapiro at 2021-05-20T22:35:40+00:00 Merge branch 'lmtp' into 'master' Set unixfrom in LMTP runner. See merge request mailman/mailman!866 - - - - - 3 changed files: - src/mailman/docs/NEWS.rst - src/mailman/runners/lmtp.py - src/mailman/runners/tests/test_lmtp.py Changes: ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -64,6 +64,7 @@ Bugs * When using MySQL, most database columns that expect user input will now accept emojis and other 4-byte unicode characters by using the utf8mb4 character set instead of 3-byte. (Closes #891) +* LMTP runner now sets unixfrom in incoming messages. (Closes #904) Command line ------------ ===================================== src/mailman/runners/lmtp.py ===================================== @@ -136,6 +136,7 @@ class LMTPHandler: # Parse the message data. If there are any defects in the # message, reject it right away; it's probably spam. msg = email.message_from_bytes(envelope.content, Message) + msg.set_unixfrom(envelope.mail_from) except Exception: elog.exception('LMTP message parsing') config.db.abort() ===================================== src/mailman/runners/tests/test_lmtp.py ===================================== @@ -43,6 +43,18 @@ class TestLMTP(unittest.TestCase): self._lmtp.lhlo('remote.example.org') self.addCleanup(self._lmtp.close) + def test_unixfrom_in_message(self): + # Ensure a unixfrom is added to the message object. + self._lmtp.sendmail('a...@example.com', ['t...@example.com'], """\ +From: a...@example.com +To: t...@example.com +Subject: Test unixfrom +Message-ID: <m...@example.com> + +""") + items = get_queue_messages('in', expected_count=1) + self.assertEqual('a...@example.com', items[0].msg.get_unixfrom()) + def test_message_id_supplied_if_missing(self): # A Message-ID header is generated if the message doesn't have one. self._lmtp.sendmail('a...@example.com', ['t...@example.com'], """\ View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/4ea9094d274f8dd2d1fb6d59f043ef1981615bd3...a1c11362510a23f7986c0134ec01d7d7bf99807b -- View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/4ea9094d274f8dd2d1fb6d59f043ef1981615bd3...a1c11362510a23f7986c0134ec01d7d7bf99807b You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list -- mailman-checkins@python.org To unsubscribe send an email to mailman-checkins-le...@python.org https://mail.python.org/mailman3/lists/mailman-checkins.python.org/ Member address: arch...@jab.org