Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make our zone parser adhere to RFC2308 wrt implicit TTLs and add test #5094

Merged
merged 5 commits into from Mar 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/markdown/changelog.raw.md
@@ -1,5 +1,21 @@
**Note**: Beyond PowerDNS 2.9.20, the Authoritative Server and Recursor are released separately.

<!--
# PowerDNS Authoritative Server 4.1.0
Unreleased

Note: this released includes a change in the BIND zonefile parser which
affects TTLs for records that did not have an explicit TTL. With this
change, we are compliant with RFC2308, but your existing zone files may now
be interpreted differently.

Specifically, where we previously used the SOA minimum field for the default
TTL if none was set explictly, or no $TTL was set, we now use the TTL from
the previous line.

- [#5094](https://github.com/PowerDNS/pdns/pull/5094): make our zone parser adhere to RFC2308 wrt implicit TTLs and add test
-->

# PowerDNS Authoritative Server 4.0.3
Released January 17th 2016

Expand Down
5 changes: 2 additions & 3 deletions pdns/zoneparser-tng.cc
Expand Up @@ -368,6 +368,8 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
}
if(!haveTTL && !haveQTYPE && isTimeSpec(nextpart)) {
rr.ttl=makeTTLFromZone(nextpart);
if(!d_havedollarttl)
d_defaultttl = rr.ttl;
haveTTL=true;
// cout<<"ttl is probably: "<<rr.ttl<<endl;
continue;
Expand Down Expand Up @@ -473,9 +475,6 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
rr.content+=std::to_string(makeTTLFromZone(recparts[n]));
else
rr.content+=recparts[n];

if(n==6 && !d_havedollarttl)
d_defaultttl=makeTTLFromZone(recparts[n]);
}
break;
default:;
Expand Down
4 changes: 4 additions & 0 deletions regression-tests.nobackend/README
@@ -0,0 +1,4 @@
To run these tests, you need a PowerDNS Authoritative Server with bind,
gsqlite3 and random backends.

You also will need to have 'faketime' installed.
2 changes: 2 additions & 0 deletions regression-tests.nobackend/zone2json-rfc2308/command
@@ -0,0 +1,2 @@
#!/bin/sh
${ZONE2JSON} --zone=zone2json-rfc2308/rfc2308.com --zone-name=example.com | jq '.records[].ttl'
1 change: 1 addition & 0 deletions regression-tests.nobackend/zone2json-rfc2308/description
@@ -0,0 +1 @@
This test verifies that we implement implicit TTL according to RFC2308.
6 changes: 6 additions & 0 deletions regression-tests.nobackend/zone2json-rfc2308/expected_result
@@ -0,0 +1,6 @@
7200
7200
7200
7200
3600
86400
8 changes: 8 additions & 0 deletions regression-tests.nobackend/zone2json-rfc2308/rfc2308.com
@@ -0,0 +1,8 @@
@ IN 7200 SOA ns1 marka.isc.org. (0 0 0 0 1)
www IN A 127.0.0.1
@ NS ns1
ns1 A 127.0.0.1
$TTL 3600
ns2 A 127.0.0.2
ns3 IN 86400 A 127.0.0.3

1 change: 1 addition & 0 deletions regression-tests/runtests
Expand Up @@ -11,6 +11,7 @@ export NOTIFY=${NOTIFY:-${PWD}/../pdns/pdns_notify}
export NSEC3DIG=${NSEC3DIG:-${PWD}/../pdns/nsec3dig}
export SAXFR=${SAXFR:-${PWD}/../pdns/saxfr}
export ZONE2SQL=${ZONE2SQL:-${PWD}/../pdns/zone2sql}
export ZONE2JSON=${ZONE2JSON:-${PWD}/../pdns/zone2json}
export ZONE2LDAP=${ZONE2LDAP:-${PWD}/../pdns/zone2ldap}
export PDNSUTIL=${PDNSUTIL:-${PWD}/../pdns/pdnsutil}
export PDNSCONTROL=${PDNSCONTROL:-${PWD}/../pdns/pdns_control}
Expand Down