Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: 333d860d by Mark Sapiro at 2021-01-28T14:12:46-08:00 Properly parse folded ``To: list-confirm+token@...`` headers. - - - - - c23b093d by Mark Sapiro at 2021-01-28T22:49:37+00:00 Merge branch 'conf' into 'master' Properly parse folded ``To: list-confirm+token@...`` headers. Closes #819 See merge request mailman/mailman!768 - - - - - 3 changed files: - src/mailman/docs/NEWS.rst - src/mailman/runners/command.py - src/mailman/runners/tests/test_confirm.py Changes: ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -42,6 +42,8 @@ Bugs several API endpoinds can be very slow. (Closes #770) * Header filter rules are now properly processed after deletions and/or reordering. (Closes #818) +* Folded ``To: list-confirm+token@...`` headers are now parsed correctly. + (Closes: #819) Command line ------------ ===================================== src/mailman/runners/command.py ===================================== @@ -69,7 +69,9 @@ class CommandFinder: is_address_command = True self.send_response = False elif subaddress == 'confirm': - mo = re.match(config.mta.verp_confirm_regexp, msg.get('to', '')) + # match with re.DOTALL in case header is folded. + mo = re.match(config.mta.verp_confirm_regexp, + msg.get('to', ''), re.DOTALL) if mo: self.command_lines.append('confirm ' + mo.group('cookie')) is_address_command = True ===================================== src/mailman/runners/tests/test_confirm.py ===================================== @@ -89,6 +89,28 @@ To: test-conf...@example.com address = manager.get_address('a...@example.org') self.assertEqual(address.email, 'a...@example.org') + def test_confirm_with_folded_to_header(self): + # Test that a folded To: header is properly parsed. + msg = mfs("""\ +From: a...@example.org +To: "test-confirm+{0}@example.com" + <test-confirm+{0}@example.com> +Subject: Your confirmation is required ... + +""".format(self._token)) + self._commandq.enqueue(msg, dict(listid='test.example.com', + subaddress='confirm')) + self._runner.run() + # Anne is now a confirmed member so her user record and email address + # should exist in the database. + manager = getUtility(IUserManager) + user = manager.get_user('a...@example.org') + address = list(user.addresses)[0] + self.assertEqual(address.email, 'a...@example.org') + self.assertEqual(address.verified_on, datetime(2005, 8, 1, 7, 49, 23)) + address = manager.get_address('a...@example.org') + self.assertEqual(address.email, 'a...@example.org') + def test_confirm_with_utf8_body(self): # Clear out the virgin queue so that the test below only sees the # reply to the confirmation message. View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/5964768c0a7110142e4e8a992953f705beb8c250...c23b093d5b8e91059d1cffb4fb31b323e60e86aa -- View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/5964768c0a7110142e4e8a992953f705beb8c250...c23b093d5b8e91059d1cffb4fb31b323e60e86aa 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