From: tmerila Date: Wed, 3 Apr 2019 11:12:23 +0000 (+0300) Subject: Update zone.py X-Git-Tag: v2.0.0rc1~352^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa5aae8921bd7706b19eb7600c6cad4c1d708d07;p=thirdparty%2Fdnspython.git Update zone.py Instead of moving the entire TTL parsing past the rdata handling (causing the RR to be parsed on the wrong way), returned the parsing to its original location, and only moved the final failure code past the rdata handling. --- diff --git a/dns/zone.py b/dns/zone.py index e80a3ca2..2b9157b9 100644 --- a/dns/zone.py +++ b/dns/zone.py @@ -659,6 +659,21 @@ class _MasterReader(object): if not token.is_identifier(): raise dns.exception.SyntaxError + # TTL + ttl = None + try: + ttl = dns.ttl.from_text(token.value) + self.last_ttl = ttl + self.last_ttl_known = True + token = self.tok.get() + if not token.is_identifier(): + raise dns.exception.SyntaxError + except dns.ttl.BadTTL: + if self.default_ttl_known: + ttl = self.default_ttl + else: + ttl = self.last_ttl + # Class try: rdclass = dns.rdataclass.from_text(token.value) @@ -705,21 +720,15 @@ class _MasterReader(object): self.default_ttl = rd.minimum self.default_ttl_known = True - # TTL - try: - ttl = dns.ttl.from_text(token.value) - self.last_ttl = ttl - self.last_ttl_known = True - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - except dns.ttl.BadTTL: + # TTL check + if ttl is None: if not (self.last_ttl_known or self.default_ttl_known): raise dns.exception.SyntaxError("Missing default TTL value") - if self.default_ttl_known: - ttl = self.default_ttl else: - ttl = self.last_ttl + if self.default_ttl_known: + ttl = self.default_ttl + else: + ttl = self.last_ttl rd.choose_relativity(self.zone.origin, self.relativize) covers = rd.covers()