Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits:
41b175d5 by Mark Sapiro at 2019-10-18T02:08:38Z
Stop confirmation or approval of a banned address.
- - - - -
fc183b5b by Mark Sapiro at 2019-10-18T04:19:10Z
Added/changed tests for commit 41b175d57be
- - - - -
faa74e7c by Mark Sapiro at 2019-10-18T20:34:39Z
Merge branch 'fix_642' into 'master'
Stop confirmation or approval of a banned address.
Closes #642
See merge request mailman/mailman!572
- - - - -
4 changed files:
- src/mailman/docs/NEWS.rst
- src/mailman/model/mailinglist.py
- src/mailman/model/tests/test_mailinglist.py
- src/mailman/utilities/tests/test_import.py
Changes:
=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -19,6 +19,8 @@ Bugs
to give it a moderaction of discard. (Closes #633)
* The issue of posting a message without a To: header to a fully personalized
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)
3.3.0 -- "Tom Sawyer"
=====================
=====================================
src/mailman/model/mailinglist.py
=====================================
@@ -27,6 +27,7 @@ from mailman.interfaces.action import Action, FilterAction
from mailman.interfaces.address import IAddress, InvalidEmailAddressError
from mailman.interfaces.archiver import ArchivePolicy
from mailman.interfaces.autorespond import ResponseAction
+from mailman.interfaces.bans import IBanManager
from mailman.interfaces.bounce import UnrecognizedBounceDisposition
from mailman.interfaces.digests import DigestFrequency
from mailman.interfaces.domain import IDomainManager
@@ -36,8 +37,8 @@ from mailman.interfaces.mailinglist import (
IHeaderMatch, IHeaderMatchList, IListArchiver, IListArchiverSet,
IMailingList, Personalization, ReplyToMunging, SubscriptionPolicy)
from mailman.interfaces.member import (
- AlreadySubscribedError, MemberRole, MissingPreferredAddressError,
- SubscriptionEvent)
+ AlreadySubscribedError, MemberRole, MembershipIsBannedError,
+ MissingPreferredAddressError, SubscriptionEvent)
from mailman.interfaces.mime import FilterType
from mailman.interfaces.nntp import NewsgroupModeration
from mailman.interfaces.user import IUser
@@ -493,6 +494,8 @@ class MailingList(Model):
raise InvalidEmailAddressError('List posting address not allowed')
if member is not None:
raise AlreadySubscribedError(self.fqdn_listname, email, role)
+ if IBanManager(self).is_banned(test_email):
+ raise MembershipIsBannedError(self, test_email)
member = Member(role=role,
list_id=self._list_id,
subscriber=subscriber)
=====================================
src/mailman/model/tests/test_mailinglist.py
=====================================
@@ -23,11 +23,13 @@ from mailman.app.lifecycle import create_list
from mailman.config import config
from mailman.database.transaction import transaction
from mailman.interfaces.address import InvalidEmailAddressError
+from mailman.interfaces.bans import IBanManager
from mailman.interfaces.listmanager import IListManager
from mailman.interfaces.mailinglist import (
IAcceptableAliasSet, IHeaderMatchList, IListArchiverSet)
from mailman.interfaces.member import (
- AlreadySubscribedError, MemberRole, MissingPreferredAddressError)
+ AlreadySubscribedError, MemberRole, MembershipIsBannedError,
+ MissingPreferredAddressError)
from mailman.interfaces.usermanager import IUserManager
from mailman.testing.helpers import (
configuration, get_queue_messages, set_preferred)
@@ -97,6 +99,13 @@ class TestMailingList(unittest.TestCase):
self.assertRaises(InvalidEmailAddressError, self._mlist.subscribe,
self._mlist.posting_address)
+ def test_cannot_subscribe_banned_address(self):
+ manager = getUtility(IUserManager)
+ user = manager.create_user('[email protected]', 'Anne Person')
+ set_preferred(user)
+ IBanManager(self._mlist).ban('[email protected]')
+ self.assertRaises(MembershipIsBannedError, self._mlist.subscribe, user)
+
def test_is_subscribed(self):
manager = getUtility(IUserManager)
user = manager.create_user('[email protected]', 'Anne Person')
=====================================
src/mailman/utilities/tests/test_import.py
=====================================
@@ -321,8 +321,8 @@ class TestBasicImport(unittest.TestCase):
def test_ban_list(self):
banned = [
- ('[email protected]', '[email protected]'),
- ('^.*@example.com', '[email protected]'),
+ ('[email protected]', '[email protected]'),
+ ('^.*@example.edu', '[email protected]'),
('non-ascii-\[email protected]', 'non-ascii-\[email protected]'),
]
self._pckdict['ban_list'] = [b[0].encode('iso-8859-1') for b in banned]
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/3df7afe6ea7a29b378ccbd4bd5c152b289f0ba33...faa74e7cfd1c0fc5ef9404e83a45f7fd8014ca3b
--
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/3df7afe6ea7a29b378ccbd4bd5c152b289f0ba33...faa74e7cfd1c0fc5ef9404e83a45f7fd8014ca3b
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org