Skip to content

Commit

Permalink
rec: only delegate if NS's are below apex in auth-zones
Browse files Browse the repository at this point in the history
As:
 1. we **are** authoritative for the zone named at the apex
 2. We would servfail because we could get an upward referral

Closes #4771

(cherry picked from commit 221a3f7)
  • Loading branch information
pieterlexis committed Feb 14, 2017
1 parent a08b422 commit 2875033
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pdns/syncres.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ bool SyncRes::doOOBResolve(const DNSName &qname, const QType &qtype, vector<DNSR
somedata=true;
if(qtype.getCode()==QType::ANY || ziter->d_type==qtype.getCode() || ziter->d_type==QType::CNAME) // let rest of nameserver do the legwork on this one
ret.push_back(*ziter);
else if(ziter->d_type == QType::NS) { // we hit a delegation point!
else if(ziter->d_type == QType::NS && ziter->d_name.countLabels() > authdomain.countLabels()) { // we hit a delegation point!
DNSRecord dr=*ziter;
dr.d_place=DNSResourceRecord::AUTHORITY;
ret.push_back(dr);
Expand Down
2 changes: 2 additions & 0 deletions regression-tests.recursor/auth-zones/command
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ cleandig host1.auth-zone.example.net. AAAA | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0
cleandig host2.auth-zone.example.net. A | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
cleandig host3.auth-zone.example.net. A | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
cleandig you-are.wild.auth-zone.example.net. TXT | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
# Non-existing QTYPE at the apex
cleandig auth-zone.example.net. TXT | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
3 changes: 3 additions & 0 deletions regression-tests.recursor/auth-zones/expected_result
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ Reply to question for qname='host3.auth-zone.example.net.', qtype=A
0 you-are.wild.auth-zone.example.net. IN TXT 3600 "Hi there!"
Rcode: 0 (No Error), RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
Reply to question for qname='you-are.wild.auth-zone.example.net.', qtype=TXT
1 auth-zone.example.net. IN SOA 3600 ns.example.net. hostmaster.example.net. 1 3600 1800 1209600 300
Rcode: 0 (No Error), RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
Reply to question for qname='auth-zone.example.net.', qtype=TXT

0 comments on commit 2875033

Please sign in to comment.