mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Correctly handle trailing . in TinyDNS source fqdns
This commit is contained in:
@@ -133,7 +133,7 @@ class TinyDnsBaseSource(BaseSource):
|
||||
'3': 'AAAA',
|
||||
'6': 'AAAA',
|
||||
}
|
||||
name_re = re.compile(fr'((?P<name>.+)\.)?{zone.name[:-1]}$')
|
||||
name_re = re.compile(fr'((?P<name>.+)\.)?{zone.name[:-1]}\.?$')
|
||||
|
||||
data = defaultdict(lambda: defaultdict(list))
|
||||
for line in self._lines():
|
||||
@@ -172,7 +172,7 @@ class TinyDnsBaseSource(BaseSource):
|
||||
)
|
||||
|
||||
def _populate_in_addr_arpa(self, zone, lenient):
|
||||
name_re = re.compile(fr'(?P<name>.+)\.{zone.name[:-1]}$')
|
||||
name_re = re.compile(fr'(?P<name>.+)\.{zone.name[:-1]}\.?$')
|
||||
|
||||
for line in self._lines():
|
||||
_type = line[0]
|
||||
@@ -188,11 +188,11 @@ class TinyDnsBaseSource(BaseSource):
|
||||
if line[0].endswith('in-addr.arpa'):
|
||||
# since it's already in in-addr.arpa format
|
||||
match = name_re.match(line[0])
|
||||
value = f'{line[1]}.'
|
||||
value = line[1]
|
||||
else:
|
||||
addr = ip_address(line[1])
|
||||
match = name_re.match(addr.reverse_pointer)
|
||||
value = f'{line[0]}.'
|
||||
value = line[0]
|
||||
|
||||
if match:
|
||||
try:
|
||||
@@ -200,6 +200,9 @@ class TinyDnsBaseSource(BaseSource):
|
||||
except IndexError:
|
||||
ttl = self.default_ttl
|
||||
|
||||
if value[-1] != '.':
|
||||
value = f'{value}.'
|
||||
|
||||
name = match.group('name')
|
||||
record = Record.new(
|
||||
zone,
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
# Multi-value A
|
||||
+example.com:10.2.3.4:30
|
||||
+example.com:10.2.3.5:30
|
||||
+example.com.:10.2.3.5:30
|
||||
|
||||
Ccname.other.foo:www.other.foo
|
||||
|
||||
# A+PTR
|
||||
=some-host-abc123.example.com:10.2.3.7:1800
|
||||
=some-host-abc123.example.com.:10.2.3.7:1800
|
||||
# A+PTR with duplicate address, fine for A's, but warning on PTRs
|
||||
=has-dup-def123.example.com:10.2.3.8
|
||||
=has-dup-def456.example.com:10.2.3.8
|
||||
@@ -26,21 +26,21 @@ Ccname.other.foo:www.other.foo
|
||||
|
||||
# MX
|
||||
@example.com::smtp-1-host.example.com:10
|
||||
@example.com::smtp-2-host.example.com:20
|
||||
@example.com.::smtp-2-host.example.com:20
|
||||
# MX with ttl
|
||||
@smtp.example.com::smtp-1-host.example.com:30:1800
|
||||
@smtp.example.com::smtp-2-host.example.com:40:1800
|
||||
@smtp.example.com.::smtp-2-host.example.com:40:1800
|
||||
|
||||
# NS
|
||||
.sub.example.com::ns3.ns.com:30
|
||||
.sub.example.com::ns4.ns.com:30
|
||||
.sub.example.com.::ns4.ns.com:30
|
||||
|
||||
# A, under sub
|
||||
+www.sub.example.com::1.2.3.4
|
||||
|
||||
# Top-level NS
|
||||
.example.com::ns1.ns.com
|
||||
.example.com::ns2.ns.com
|
||||
.example.com.::ns2.ns.com
|
||||
|
||||
# sub special cases
|
||||
+a1.blah-asdf.subtest.com:10.2.3.5
|
||||
|
||||
Reference in New Issue
Block a user