Create GOSSiP record only when connection will procede to DATA.

This commit is contained in:
Stuart Gathman
2006-05-17 21:28:07 +00:00
parent a9ffc3ae28
commit 528810c31a
+12 -2
View File
@@ -1,6 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
# A simple milter that has grown quite a bit. # A simple milter that has grown quite a bit.
# $Log$ # $Log$
# Revision 1.60 2006/05/12 16:14:48 customdesigned
# Don't require SPF pass for white/black listing mail from trusted relay.
# Support localpart wildcard for white and black lists.
#
# Revision 1.59 2006/04/06 18:14:17 customdesigned # Revision 1.59 2006/04/06 18:14:17 customdesigned
# Check whitelist/blacklist even when not checking SPF (e.g. trusted relay). # Check whitelist/blacklist even when not checking SPF (e.g. trusted relay).
# #
@@ -231,6 +235,10 @@ try: import spf
except: spf = None except: spf = None
ip4re = re.compile(r'^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$') ip4re = re.compile(r'^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$')
# Sometimes, MTAs reply to our DSN. We recognize this type of reply/DSN
# and check for the original recipient SRS encoded in Message-ID.
# If found, we blacklist that recipient.
subjpats = ( subjpats = (
r'^failure notice', r'^failure notice',
r'^returned mail', r'^returned mail',
@@ -238,7 +246,9 @@ subjpats = (
r'^delivery\b.*\bfailure', r'^delivery\b.*\bfailure',
r'^delivery problem', r'^delivery problem',
r'\buser unknown\b', r'\buser unknown\b',
r'^failed' r'^failed',
r'^echec de distribution',
r'^fallo en la entrega'
) )
refaildsn = re.compile('|'.join(subjpats),re.IGNORECASE) refaildsn = re.compile('|'.join(subjpats),re.IGNORECASE)
import logging import logging
@@ -946,7 +956,7 @@ class bmsMilter(Milter.Milter):
or domain in blacklist: or domain in blacklist:
self.blacklist = True self.blacklist = True
self.log("BLACKLIST",self.canon_from) self.log("BLACKLIST",self.canon_from)
if gossip: if gossip and domain and rc == Milter.CONTINUE:
if self.spf and self.spf.result == 'pass': if self.spf and self.spf.result == 'pass':
qual = 'SPF' qual = 'SPF'
else: else: