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

Fix bug from pyspf - caching server altering case of cached names.

parent 8dfda22c
No related branches found
No related tags found
No related merge requests found
...@@ -73,6 +73,7 @@ class Session(object): ...@@ -73,6 +73,7 @@ class Session(object):
if name.endswith('.'): name = name[:-1] if name.endswith('.'): name = name[:-1]
if not reduce(lambda x,y:x and 0 < len(y) < 64, name.split('.'),True): if not reduce(lambda x,y:x and 0 < len(y) < 64, name.split('.'),True):
return [] # invalid DNS name (too long or empty) return [] # invalid DNS name (too long or empty)
name = name.lower()
result = self.cache.get( (name, qtype) ) result = self.cache.get( (name, qtype) )
cname = None cname = None
if result: return result if result: return result
...@@ -96,7 +97,7 @@ class Session(object): ...@@ -96,7 +97,7 @@ class Session(object):
#return result # if too many == NX_DOMAIN #return result # if too many == NX_DOMAIN
raise DNSError('Length of CNAME chain exceeds %d' % MAX_CNAME) raise DNSError('Length of CNAME chain exceeds %d' % MAX_CNAME)
cnames[name] = cname cnames[name] = cname
if cname in cnames: if cname.lower().rstrip('.') in cnames:
raise DNSError('CNAME loop') raise DNSError('CNAME loop')
result = self.dns(cname, qtype, cnames=cnames) result = self.dns(cname, qtype, cnames=cnames)
if result: if result:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment