From 753c417f31a224b380d3787f39c89e806feff0ae Mon Sep 17 00:00:00 2001 From: Stuart Gathman Date: Tue, 17 Feb 2015 22:46:36 +0000 Subject: [PATCH] Fix bug from pyspf - caching server altering case of cached names. --- Milter/dns.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Milter/dns.py b/Milter/dns.py index f8991c7..c626444 100644 --- a/Milter/dns.py +++ b/Milter/dns.py @@ -73,6 +73,7 @@ class Session(object): 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) + name = name.lower() result = self.cache.get( (name, qtype) ) cname = None if result: return result @@ -96,7 +97,7 @@ class Session(object): #return result # if too many == NX_DOMAIN raise DNSError('Length of CNAME chain exceeds %d' % MAX_CNAME) cnames[name] = cname - if cname in cnames: + if cname.lower().rstrip('.') in cnames: raise DNSError('CNAME loop') result = self.dns(cname, qtype, cnames=cnames) if result: