Skip to content
Snippets Groups Projects
Commit c9f0c94b authored by Stuart Gathman's avatar Stuart Gathman
Browse files

Reject multiple recipients to DSN.

Auto-disable gossip on DB error.
parent 59bf86e7
Branches
Tags
No related merge requests found
#!/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.72 2006/11/22 16:31:22 customdesigned
# SRS domains were missing srs_reject check when SES was active.
#
# Revision 1.71 2006/11/22 01:03:28 customdesigned # Revision 1.71 2006/11/22 01:03:28 customdesigned
# Replace last use of deprecated rfc822 module. # Replace last use of deprecated rfc822 module.
# #
...@@ -807,14 +810,19 @@ class bmsMilter(Milter.Milter): ...@@ -807,14 +810,19 @@ 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)
global gossip
if gossip and domain and rc == Milter.CONTINUE: 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:
qual = self.connectip qual = self.connectip
try:
self.umis = gossip.umis(domain+qual,self.id+time.time()) self.umis = gossip.umis(domain+qual,self.id+time.time())
res,hdr,val = gossip_node.query(self.umis,domain,qual,1) res,hdr,val = gossip_node.query(self.umis,domain,qual,1)
self.add_header(hdr,val) self.add_header(hdr,val)
except:
gossip = None
raise
return rc return rc
def check_spf(self): def check_spf(self):
...@@ -958,8 +966,8 @@ class bmsMilter(Milter.Milter): ...@@ -958,8 +966,8 @@ class bmsMilter(Milter.Milter):
def envrcpt(self,to,*str): def envrcpt(self,to,*str):
# mail to MAILER-DAEMON is generally spam that bounced # mail to MAILER-DAEMON is generally spam that bounced
if to.startswith('<MAILER-DAEMON@'): if to.startswith('<MAILER-DAEMON@'):
self.log('DISCARD: RCPT TO:',to,str) self.log('REJECT: RCPT TO:',to,str)
return Milter.DISCARD return Milter.REJECT
self.log("rcpt to",to,str) self.log("rcpt to",to,str)
t = parse_addr(to) t = parse_addr(to)
newaddr = False newaddr = False
...@@ -1425,6 +1433,11 @@ class bmsMilter(Milter.Milter): ...@@ -1425,6 +1433,11 @@ class bmsMilter(Milter.Milter):
if not self.fp: if not self.fp:
return Milter.ACCEPT # no message collected - so no eom processing return Milter.ACCEPT # no message collected - so no eom processing
if self.is_bounce and len(self.recipients) > 1:
self.log("REJECT: DSN to multiple recipients")
self.setreply('550','5.7.1', 'DSN to multiple recipients')
return Milter.REJECT
try: try:
# check for delayed bounce # check for delayed bounce
if self.delayed_failure: if self.delayed_failure:
......
...@@ -16,5 +16,6 @@ ...@@ -16,5 +16,6 @@
<li><a href="http://www.sendmail.org/">Sendmail.Org</a> <li><a href="http://www.sendmail.org/">Sendmail.Org</a>
<li><a href="http://www.openspf.org/">SPF</a> <li><a href="http://www.openspf.org/">SPF</a>
<li><a href="pysrs.html">pysrs</a> <li><a href="pysrs.html">pysrs</a>
<li><a href="http://cheeseshop.python.org/pypi/pyspf">pyspf</a>
<li><a href="http://bmsi.com/python/dspam.html">pydspam</a> <li><a href="http://bmsi.com/python/dspam.html">pydspam</a>
<li><a href="http://bmsi.com/libdspam/dspam.html">libdspam</a> <li><a href="http://bmsi.com/libdspam/dspam.html">libdspam</a>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment