]> git.ipfire.org Git - thirdparty/dnspython.git/commit
Improve TTL detection when reading master zone files. 255/head
authorTom Lanyon <tomlanyon@google.com>
Tue, 30 May 2017 07:19:20 +0000 (17:19 +1000)
committerTom Lanyon <tomlanyon@google.com>
Wed, 31 May 2017 01:50:21 +0000 (11:50 +1000)
commit11bdb15d9c8037850d9ca5ea21b713d6283fab19
tree0d309d52912985ba5a42697f1ce271425a8a528a
parent6b11f2677fe6d4da653a85512ab73fa31c27214f
Improve TTL detection when reading master zone files.

This introduces the same behaviour that BIND has when it encounters implicit TTL
values, namely:
  * The $TTL directive is preferred to set the default TTL [RFC2308].
  * If no $TTL directive is seen prior to the SOA RR, the default TTL is set
    to the minimum TTL field of the SOA RR [RFC1033, RFC1035, RFC1912].
  * If neither $TTL nor an SOA are present, use the last seen explicit TTL on an
    RR or raise a SyntaxError if no explicit TTLs have been seen.

Previously, when neither $TTL nor SOA were present, the TTL for an RR without
an explicit TTL would be set to 0 which is known to be a somewhat dangerous
value and shouldn't be encouraged as a default.

One test seems to rely on this default TTL=0 behaviour whilst testing something
seemingly unrelated (RR starting with whitespace), so that test has been
updated to match this new expectation.

Fixes #254.
LICENSE
dns/zone.py
tests/test_zone.py