aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Handlers
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2014-07-10 13:25:39 -0700
committerMark Sapiro <mark@msapiro.net>2014-07-10 13:25:39 -0700
commitddfc6686ce7ad6131a85e4f21ac1a1dca7a6e35a (patch)
treeac789255538c58e50a47a9b7b6784f501e757c6e /Mailman/Handlers
parent96d4baef3921957666dd6979855a6edf73f7eb75 (diff)
downloadmailman2-ddfc6686ce7ad6131a85e4f21ac1a1dca7a6e35a.tar.gz
mailman2-ddfc6686ce7ad6131a85e4f21ac1a1dca7a6e35a.tar.xz
mailman2-ddfc6686ce7ad6131a85e4f21ac1a1dca7a6e35a.zip
Fix for lp:1334450 requires toowner exemption for dmarc_moderation_action.
Diffstat (limited to 'Mailman/Handlers')
-rw-r--r--Mailman/Handlers/SpamDetect.py43
1 files changed, 23 insertions, 20 deletions
diff --git a/Mailman/Handlers/SpamDetect.py b/Mailman/Handlers/SpamDetect.py
index 85d8af58..119c5beb 100644
--- a/Mailman/Handlers/SpamDetect.py
+++ b/Mailman/Handlers/SpamDetect.py
@@ -87,30 +87,33 @@ def process(mlist, msg, msgdata):
# Before anything else, check DMARC if necessary. We do this as early
# as possible so reject/discard actions trump other holds/approvals and
# wrap/munge actions get flagged even for approved messages.
- msgdata['from_is_list'] = 0
- dn, addr = parseaddr(msg.get('from'))
- if addr and mlist.dmarc_moderation_action > 0:
- if Utils.IsDMARCProhibited(mlist, addr):
- # Note that for dmarc_moderation_action, 0 = Accept,
- # 1 = Munge, 2 = Wrap, 3 = Reject, 4 = Discard
- if mlist.dmarc_moderation_action == 1:
- msgdata['from_is_list'] = 1
- elif mlist.dmarc_moderation_action == 2:
- msgdata['from_is_list'] = 2
- elif mlist.dmarc_moderation_action == 3:
- # Reject
- text = mlist.dmarc_moderation_notice
- if text:
- text = Utils.wrap(text)
- else:
- text = Utils.wrap(_(
+ # But not for owner mail which should not be subject to DMARC reject or
+ # discard actions.
+ if not msgdata.get('toowner'):
+ msgdata['from_is_list'] = 0
+ dn, addr = parseaddr(msg.get('from'))
+ if addr and mlist.dmarc_moderation_action > 0:
+ if Utils.IsDMARCProhibited(mlist, addr):
+ # Note that for dmarc_moderation_action, 0 = Accept,
+ # 1 = Munge, 2 = Wrap, 3 = Reject, 4 = Discard
+ if mlist.dmarc_moderation_action == 1:
+ msgdata['from_is_list'] = 1
+ elif mlist.dmarc_moderation_action == 2:
+ msgdata['from_is_list'] = 2
+ elif mlist.dmarc_moderation_action == 3:
+ # Reject
+ text = mlist.dmarc_moderation_notice
+ if text:
+ text = Utils.wrap(text)
+ else:
+ text = Utils.wrap(_(
"""You are not allowed to post to this mailing list From: a domain which
publishes a DMARC policy of reject or quarantine, and your message has been
automatically rejected. If you think that your messages are being rejected in
error, contact the mailing list owner at %(listowner)s."""))
- raise Errors.RejectMessage, text
- elif mlist.dmarc_moderation_action == 4:
- raise Errors.DiscardMessage
+ raise Errors.RejectMessage, text
+ elif mlist.dmarc_moderation_action == 4:
+ raise Errors.DiscardMessage
if msgdata.get('approved'):
return
# First do site hard coded header spam checks