From: Bob Halley Date: Sun, 31 Mar 2013 11:21:34 +0000 (+0100) Subject: Raise YXDOMAIN if we see a YXDOMAIN rcode X-Git-Tag: v1.11.0-py3~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2bdfe09e419cfe0a55dc3187121e41a5a0cd675;p=thirdparty%2Fdnspython.git Raise YXDOMAIN if we see a YXDOMAIN rcode --- diff --git a/dns/resolver.py b/dns/resolver.py index 97fda1c4..21592bc7 100644 --- a/dns/resolver.py +++ b/dns/resolver.py @@ -41,6 +41,10 @@ class NXDOMAIN(dns.exception.DNSException): """The query name does not exist.""" pass +class YXDOMAIN(dns.exception.DNSException): + """The query name is too long after DNAME substitution.""" + pass + # The definition of the Timeout exception has moved from here to the # dns.exception module. We keep dns.resolver.Timeout defined for # backwards compatibility. @@ -714,6 +718,7 @@ class Resolver(object): @rtype: dns.resolver.Answer instance @raises Timeout: no answers could be found in the specified lifetime @raises NXDOMAIN: the query name does not exist + @raises YXDOMAIN: the query name is too long after DNAME substitution @raises NoAnswer: the response did not contain an answer and raise_on_no_answer is True. @raises NoNameservers: no non-broken nameservers are available to @@ -818,6 +823,8 @@ class Resolver(object): response = None continue rcode = response.rcode() + if rcode == dns.rcode.YXDOMAIN: + raise YXDOMAIN if rcode == dns.rcode.NOERROR or \ rcode == dns.rcode.NXDOMAIN: break