------------------------------------------------------------
revno: 1352
committer: Mark Sapiro <m...@msapiro.net>
branch nick: 2.2
timestamp: Thu 2014-07-10 13:26:48 -0700
message:
  Fix for lp:1334450 requires toowner exemption for dmarc_moderation_action.
modified:
  Mailman/Handlers/SpamDetect.py


--
lp:mailman/2.2
https://code.launchpad.net/~mailman-coders/mailman/2.2

Your team Mailman Checkins is subscribed to branch lp:mailman/2.2.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.2/+edit-subscription
=== modified file 'Mailman/Handlers/SpamDetect.py'
--- Mailman/Handlers/SpamDetect.py	2014-06-26 21:54:02 +0000
+++ Mailman/Handlers/SpamDetect.py	2014-07-10 20:26:48 +0000
@@ -87,30 +87,33 @@
     # 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

_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to