This is based in part on Bryan Fullerton's patch, but also fixes another part of the code where large messages (naturally, the most likely ones to be a problem for people going over quota) could bounce instead of being deferred.
I also parameterized the TEMPFAIL exit code just in case, and did the exit(1) locally instead of raising the SMTP error to match the logic in both parts of the patch. I haven't tested this yet, so caveat emptor, etc. The changes are pretty minimal and should at least be no more broken than the existing code. Diff is against the 1.2 version from CVS. I've also logged this as Bugzilla #385. --- spamcheck.py.orig Sun Jun 2 21:39:27 2002 +++ spamcheck.py Sun Jun 2 21:40:28 2002 @@ -36,6 +36,10 @@ import re, getopt import smtplib, socket +# EX_TEMPFAIL is 75 on every Unix I've checked, but... +# check /usr/include/sysexits.h if you have odd problems. +TEMPFAIL = 75 + # this class hacks smtplib's SMTP class into a shape where it will # successfully pass a message off to Cyrus's LMTP daemon. # Also adds support for connecting to a unix domain socket. @@ -186,9 +190,13 @@ if code != 250: sys.exit(1) #lmtp.set_debuglevel(1) - errors = lmtp.sendmail(sender, recipient, checked_data) - if errors: - sys.exit(1) + try: + lmtp.sendmail(sender, recipient, checked_data) + except smtplib.SMTPDataError, errors: + if errors.smtp_code/100 == 4: + sys.exit(TEMPFAIL) + else: + sys.exit(1) else: # too much data. Just pass it through unchanged lmtp = LMTP(lmtp_host) @@ -215,7 +223,10 @@ lmtp.send('\r\n.\r\n') code, msg = lmtp.getreply() - if code != 250: sys.exit(1) + if code/100 == 4: + sys.exit(TEMPFAIL) + elif code != 250: + sys.exit(1) def main(argv): spamd_host = 'localhost' -- Christopher Davis * <[EMAIL PROTECTED]> * <URL:http://www.ckdhr.com/ckd/> Put location information in your DNS! <URL:http://www.ckdhr.com/dns-loc/> Bill, n. 2. A writing binding the signer [...] to pay [...] Gates, n. 4. The places which command the entrances or access [...] _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk