]> granicus.if.org Git - pdns/commitdiff
Fix 'same level NS referral', as exemplified by the new same-level-referrel regressio...
authorBert Hubert <bert.hubert@netherlabs.nl>
Fri, 11 Nov 2005 11:17:47 +0000 (11:17 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Fri, 11 Nov 2005 11:17:47 +0000 (11:17 +0000)
This solves where the zone contains 'france.example.com NS somewhere.com' and a query comes in for 'france.example.com'
This problem was new in 2.9.19, caused by the cname/wildcard patches
(plus removal of an unused file)

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@539 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/packethandler.cc
regression-tests/basic-txt-resolution/expected_result
regression-tests/internal-referral/expected_output [deleted file]
regression-tests/same-level-referral/command [new file with mode: 0755]
regression-tests/same-level-referral/description [new file with mode: 0644]
regression-tests/same-level-referral/expected_result [new file with mode: 0644]

index 167a22d9fb140499e438a37fe9f735c636d2dc33..85b3ef0031c3f36da6a1e12ec96f773837da826f 100644 (file)
@@ -389,7 +389,8 @@ int PacketHandler::makeCanonic(DNSPacket *p, DNSPacket *r, string &target)
     int hits=0;
 
     while(B.get(rr)) {
-      hits++;
+      if(rr.qtype.getCode()!=QType::NS || p->qtype.getCode()==QType::NS)
+       hits++;
       if(!rfound && rr.qtype.getCode()==QType::CNAME) {
        found=true;
        r->addRecord(rr);
@@ -636,6 +637,7 @@ DNSPacket *PacketHandler::question(DNSPacket *p)
     mret=makeCanonic(p, r, target); // traverse CNAME chain until we have a useful record (may actually give the correct answer!)
 
     if(mret==2) { // there is some data, but not of the correct type
+      DLOG(L<<"There is some data, but not of the correct type"<<endl);
       SOAData sd;
       if(getAuth(p, &sd, target, 0)) {
        rr.qname=sd.qname;
index de043a6cb86a16b22a661eb5f96410a8b6c4f7bd..fb595d493bbc90cc2cf6f37119c8001d087f03a1 100644 (file)
@@ -1,3 +1,3 @@
-0      text.example.com.       IN      TXT     120     "hi, this is some text"
+0      text.example.com.       IN      TXT     120     "Hi, this is some text"
 Rcode: 0, RD: 0, TC: 0, AA: 1, opcode: 0
 Reply to question for qname='text.example.com.', qtype=TXT
diff --git a/regression-tests/internal-referral/expected_output b/regression-tests/internal-referral/expected_output
deleted file mode 100644 (file)
index 7f8cc20..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-
-;; ->>HEADER<<- opcode: QUERY, status: NOERROR
-;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 2, ADDITIONAL: 2
-;; QUERY SECTION:
-;;     www.usa.example.com, type = A, class = IN
-
-;; AUTHORITY SECTION:
-usa.example.com.       2M IN NS        usa-ns1.usa.example.com.
-usa.example.com.       2M IN NS        usa-ns2.usa.example.com.
-
-;; ADDITIONAL SECTION:
-usa-ns1.usa.example.com.  2M IN A  192.168.4.1
-usa-ns2.usa.example.com.  2M IN A  192.168.4.2
-
-
diff --git a/regression-tests/same-level-referral/command b/regression-tests/same-level-referral/command
new file mode 100755 (executable)
index 0000000..76c6507
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+cleandig france.example.com A
diff --git a/regression-tests/same-level-referral/description b/regression-tests/same-level-referral/description
new file mode 100644 (file)
index 0000000..3342e4d
--- /dev/null
@@ -0,0 +1 @@
+A referral with the same name as the NS record itself. This broke in 2.9.19.
diff --git a/regression-tests/same-level-referral/expected_result b/regression-tests/same-level-referral/expected_result
new file mode 100644 (file)
index 0000000..f4aece2
--- /dev/null
@@ -0,0 +1,4 @@
+1      france.example.com.     IN      NS      120     ns1.otherprovider.net.
+1      france.example.com.     IN      NS      120     ns2.otherprovider.net.
+Rcode: 0, RD: 0, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='france.example.com.', qtype=A