diff options
-rw-r--r-- | Mailman/Handlers/Moderate.py | 16 | ||||
-rwxr-xr-x | Mailman/MailList.py | 2 | ||||
-rw-r--r-- | Mailman/Utils.py | 2 |
3 files changed, 7 insertions, 13 deletions
diff --git a/Mailman/Handlers/Moderate.py b/Mailman/Handlers/Moderate.py index 81b554e4..9b5f0600 100644 --- a/Mailman/Handlers/Moderate.py +++ b/Mailman/Handlers/Moderate.py @@ -57,13 +57,13 @@ def process(mlist, msg, msgdata): sender = None if sender: if Utils.IsDmarcProhibited(sender): - # Note that for dmarc_moderation_action, 0==Hold, 1=Reject, - # 2==Discard - if mlist.dmarc_moderation_action == 0: + # Note that for dmarc_moderation_action, 0 = Accept, + # 1 = Hold, 2 = Reject, 3 = Discard + if mlist.dmarc_moderation_action == 1: msgdata['sender'] = sender Hold.hold_for_approval(mlist, msg, msgdata, ModeratedMemberPost) - elif mlist.dmarc_moderation_action == 1: + elif mlist.dmarc_moderation_action == 2: # Reject text = mlist.dmarc_moderation_notice if text: @@ -72,14 +72,8 @@ def process(mlist, msg, msgdata): # Use the default RejectMessage notice string text = None raise Errors.RejectMessage, text - elif mlist.dmarc_moderation_action == 2: + elif mlist.dmarc_moderation_action == 3: raise Errors.DiscardMessage - else: - assert 0, 'bad dmarc_moderation_action' - - # sender's domain has a 'p=reject' _dmarc TXT record, - # we should NOT automatically reflect this email - return # If the member's moderation flag is on, then perform the moderation # action. diff --git a/Mailman/MailList.py b/Mailman/MailList.py index a51f4ea6..4a3e92a8 100755 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -388,7 +388,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, # 2==Discard self.member_moderation_action = 0 self.member_moderation_notice = '' - self.dmarc_moderation_action = 0 + self.dmarc_moderation_action = mm_cfg.DEFAULT_DMARC_MODERATION_ACTION self.dmarc_moderation_notice = '' self.accept_these_nonmembers = [] self.hold_these_nonmembers = [] diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 6c839a3c..ec9174c7 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -1079,7 +1079,7 @@ def IsDmarcProhibited(email): try: resolver = dns.resolver.Resolver() - resolver.timeout = 1 + resolver.timeout = 3 resolver.lifetime = 5 txt_recs = resolver.query(dmarc_domain, dns.rdatatype.TXT) except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): |