[Pymilter] pyspf SPF checking raises TypeError exception when checking erroneous record
Stuart D Gathman
stuart at bmsi.com
Mon Mar 25 18:03:09 EDT 2013
On Mar 18, Kazuhiro Ogura transmitted in part:
> Can you try it with a zonedata like this?
>
> zonedata:
> e3.example.com:
> - SPF: v=spf1 a:mx1.example.com mx:mx1.example.com -all
> mx1.example.com:
> - CNAME: .
That does indeed break it with real DNS, but not as a test case.
The reason is that the mock DNSLookup doesn't include supplementary
data in addition to answers like a real DNS server does. This
supplementary data gets added to a short lived (only for one mail
connection) cache, and having the empty CNAME in the cache is what
breaks it.
I am working on improving the mock DNSLookup.
Here is the fix:
@@ -1264,7 +1261,7 @@
if name.endswith('.'): name = name[:-1]
if not reduce(lambda x,y:x and 0 < len(y) < 64,
name.split('.'),True):
return [] # invalid DNS name (too long or empty)
- result = self.cache.get( (name, qtype) )
+ result = self.cache.get( (name, qtype), [])
if result: return result
cnamek = (name,'CNAME')
cname = self.cache.get( cnamek )
More information about the Pymilter
mailing list