svn path=/trunk/packages/invirt-dns/; revision=2207
if name in self.domains:
domain = name
else:
- # Look for the longest-matching domain. (This works because domain
- # will remain bound after breaking out of the loop.)
+ # Look for the longest-matching domain.
best_domain = ''
for domain in self.domains:
if name.endswith('.'+domain) and len(domain) > len(best_domain):
best_domain = domain
if best_domain == '':
if name.endswith('.in-addr.arpa'):
- best_domain = name # Act authoritative for the IP address for reverse resolution requests
+ # Act authoritative for the IP address for reverse resolution requests
+ best_domain = name
else:
return defer.fail(failure.Failure(dns.DomainError(name)))
domain = best_domain