Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: 34ed380d by Mark Sapiro at 2019-10-18T22:46:33Z Catch MembershipIsBannedError in eml_confirm.py. - - - - - 03f52f33 by Mark Sapiro at 2019-10-20T03:56:33Z Merge branch 'fix_643' into 'master' Catch MembershipIsBannedError in eml_confirm.py. Closes #643 See merge request mailman/mailman!573 - - - - - 3 changed files: - src/mailman/commands/eml_confirm.py - src/mailman/commands/tests/test_eml_confirm.py - src/mailman/docs/NEWS.rst Changes: ===================================== src/mailman/commands/eml_confirm.py ===================================== @@ -19,6 +19,7 @@ from mailman.core.i18n import _ from mailman.interfaces.command import ContinueProcessing, IEmailCommand +from mailman.interfaces.member import MembershipIsBannedError from mailman.interfaces.subscriptions import ISubscriptionManager, TokenOwner from public import public from zope.interface import implementer @@ -70,6 +71,9 @@ class Confirm: except LookupError: # The token must not exist in the database. succeeded = False + except MembershipIsBannedError as e: + print(str(e), file=results) + return ContinueProcessing.no if succeeded: print(_('Confirmed'), file=results) # After the 'confirm' command, do not process any other commands in ===================================== src/mailman/commands/tests/test_eml_confirm.py ===================================== @@ -23,6 +23,7 @@ from mailman.app.lifecycle import create_list from mailman.commands.eml_confirm import Confirm from mailman.config import config from mailman.email.message import Message +from mailman.interfaces.bans import IBanManager from mailman.interfaces.command import ContinueProcessing from mailman.interfaces.mailinglist import SubscriptionPolicy from mailman.interfaces.subscriptions import ISubscriptionManager @@ -83,6 +84,19 @@ class TestConfirmJoin(unittest.TestCase): self._mlist, Message(), {}, (self._token,), result) self.assertEqual(status, ContinueProcessing.no) + def test_confirm_banned_address(self): + # Confirmation of a banned address should return an appropriate error. + IBanManager(self._mlist).ban('a...@example.com') + result = Results() + status = self._command.process( + self._mlist, Message(), {}, (self._token,), result) + self.assertEqual(status, ContinueProcessing.no) + # Anne will not be subscribed. + self.assertFalse(self._mlist.is_subscribed('a...@example.com')) + # The result will contain an error message. + self.assertIn('a...@example.com is not allowed to subscribe to ' + 't...@example.com', str(result)) + class TestConfirmLeave(unittest.TestCase): """Test the `confirm` command when leaving a mailing list.""" ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -21,6 +21,9 @@ Bugs list throwing a KeyError has been fixed. (Closes #639) * Confirmation or moderator approval of a subscription from an address banned subsequent to subscribing will no longer succeed. (Closes #642) +* Fixed an issue caused by the fix for #642 where email confirmation of a + banned subscription address would cause a shunted message. (Closes #643) + 3.3.0 -- "Tom Sawyer" ===================== View it on GitLab: https://gitlab.com/mailman/mailman/compare/faa74e7cfd1c0fc5ef9404e83a45f7fd8014ca3b...03f52f338762eb23cce01b383ca2fe8406eb0729 -- View it on GitLab: https://gitlab.com/mailman/mailman/compare/faa74e7cfd1c0fc5ef9404e83a45f7fd8014ca3b...03f52f338762eb23cce01b383ca2fe8406eb0729 You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org