] # default_ttl_known
+def _upper_dollarize(s):
+ s = s.upper()
+ if not s.startswith("$"):
+ s = "$" + s
+ return s
+
+
class Reader:
"""Read a DNS zone file into a transaction."""
else:
# Note that if directives are explicitly specified, then allow_include
# is ignored.
- self.allowed_directives = set(d.upper() for d in allow_directives)
+ self.allowed_directives = set(_upper_dollarize(d) for d in allow_directives)
self.force_name = force_name
self.force_ttl = force_ttl
self.force_rdclass = force_rdclass
z2 = dns.zone.from_file(here("example"), "example.", relativize=True)
self.assertEqual(z1, z2)
+ def testExplicitIncludeNotUpperNoDollar(self):
+ z1 = dns.zone.from_text(
+ include_text,
+ "example.",
+ relativize=True,
+ allow_directives={"InClUdE", "origin", "TTL"},
+ )
+ z2 = dns.zone.from_file(here("example"), "example.", relativize=True)
+ self.assertEqual(z1, z2)
+
def testExplicitLowerCase(self):
z1 = dns.zone.from_text(
include_text,