Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core
Commits:
bf1f2c9d by Mark Sapiro at 2019-07-10T17:55:33Z
Allow Reply-To: the list in posts.
- - - - -
160b9f0e by Abhilash Raj at 2019-07-10T17:55:33Z
Merge branch 'fix_614' into 'master'
Allow Reply-To: the list in posts.
Closes #614
See merge request mailman/mailman!535
- - - - -
3 changed files:
- src/mailman/docs/NEWS.rst
- src/mailman/rules/moderation.py
- src/mailman/rules/tests/test_moderation.py
Changes:
=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -33,6 +33,8 @@ Bugs
a list. (Closes #599)
* Fixed the nntp runner which was calling the ``nntplib.NNTP.post()`` method
with a string object instead of bytes. (Closes #613)
+* A post with a Reply-To: the list address will no longer be shunted.
+ (Closes #614)
Command line
------------
=====================================
src/mailman/rules/moderation.py
=====================================
@@ -19,8 +19,10 @@
import re
+from contextlib import suppress
from mailman.core.i18n import _
from mailman.interfaces.action import Action
+from mailman.interfaces.address import InvalidEmailAddressError
from mailman.interfaces.bans import IBanManager
from mailman.interfaces.member import MemberRole
from mailman.interfaces.rules import IRule
@@ -134,7 +136,10 @@ class NonmemberModeration:
address = user_manager.get_address(sender)
assert address is not None, (
'Posting address is not registered: {}'.format(sender))
- mlist.subscribe(address, MemberRole.nonmember)
+ with suppress(InvalidEmailAddressError):
+ # This might be a list posting address in Reply-To: or
+ # some other invalid address. In any case, ignore it.
+ mlist.subscribe(address, MemberRole.nonmember)
# Check to see if any of the sender emails is already a member. If
# so, then this rule misses.
member = _find_sender_member(mlist, msg)
=====================================
src/mailman/rules/tests/test_moderation.py
=====================================
@@ -332,3 +332,23 @@ A message body.
'moderation_reasons': ['No sender was found in the message.'],
'moderation_sender': 'No sender',
})
+
+ def test_reply_to_list(self):
+ # Test a post from a member with the list posting address in Reply-To:.
+ rule = moderation.NonmemberModeration()
+ user_manager = getUtility(IUserManager)
+ anne = user_manager.create_address('[email protected]')
+ user_manager.create_address('[email protected]')
+ self._mlist.subscribe(anne, MemberRole.member)
+ msg = mfs("""\
+From: [email protected]
+To: [email protected]
+Reply-To: [email protected]
+Subject: A test message
+Message-ID: <ant>
+MIME-Version: 1.0
+
+A message body.
+""")
+ result = rule.check(self._mlist, msg, {})
+ self.assertFalse(result)
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/7b9143229c3b8417556fcf96dd7ae23b8b316747...160b9f0e5cb1e0bf49a0a9a025be7cf1ae4e70b1
--
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/7b9143229c3b8417556fcf96dd7ae23b8b316747...160b9f0e5cb1e0bf49a0a9a025be7cf1ae4e70b1
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