Delete unparseable timestamps when loading address cache. These have
arisen because of failure to parse MAIL FROM properly. Will have to tighten up MAIL FROM parsing to match RFC.
This commit is contained in:
+8
-1
@@ -10,6 +10,9 @@
|
|||||||
# CBV results.
|
# CBV results.
|
||||||
#
|
#
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.7 2007/01/25 22:47:26 customdesigned
|
||||||
|
# Persist blacklisting from delayed DSNs.
|
||||||
|
#
|
||||||
# Revision 1.6 2007/01/19 23:31:38 customdesigned
|
# Revision 1.6 2007/01/19 23:31:38 customdesigned
|
||||||
# Move parse_header to Milter.utils.
|
# Move parse_header to Milter.utils.
|
||||||
# Test case for delayed DSN parsing.
|
# Test case for delayed DSN parsing.
|
||||||
@@ -66,13 +69,17 @@ class AddrCache(object):
|
|||||||
for ln in fp:
|
for ln in fp:
|
||||||
try:
|
try:
|
||||||
rcpt,ts = ln.strip().split(None,1)
|
rcpt,ts = ln.strip().split(None,1)
|
||||||
|
try:
|
||||||
l = time.strptime(ts,AddrCache.time_format)
|
l = time.strptime(ts,AddrCache.time_format)
|
||||||
t = time.mktime(l)
|
t = time.mktime(l)
|
||||||
if t < too_old:
|
if t < too_old:
|
||||||
changed = True
|
changed = True
|
||||||
continue
|
continue
|
||||||
cache[rcpt.lower()] = (t,None)
|
cache[rcpt.lower()] = (t,None)
|
||||||
except:
|
except: # unparsable timestamp - likely garbage
|
||||||
|
changed = True
|
||||||
|
continue
|
||||||
|
except: # manual entry (no timestamp)
|
||||||
cache[ln.strip().lower()] = (now,None)
|
cache[ln.strip().lower()] = (now,None)
|
||||||
wfp.write(ln)
|
wfp.write(ln)
|
||||||
if changed:
|
if changed:
|
||||||
|
|||||||
Reference in New Issue
Block a user