]> granicus.if.org Git - pdns/commitdiff
add testcase for wildcard CNAME pointing to a record that does not have the type...
authorBert Hubert <bert.hubert@netherlabs.nl>
Mon, 15 Mar 2010 21:38:31 +0000 (21:38 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Mon, 15 Mar 2010 21:38:31 +0000 (21:38 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1543 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/packethandler.cc
regression-tests/cname-and-wildcard-but-no-correct-type/command [new file with mode: 0755]
regression-tests/cname-and-wildcard-but-no-correct-type/description [new file with mode: 0644]
regression-tests/cname-and-wildcard-but-no-correct-type/expected_result [new file with mode: 0644]

index 84b623e37ff950cc3e0c00f3a5bcd59af4b45ccb..fd8e2680f99dd4b10e5680f147d8fd1af6467d39 100644 (file)
@@ -653,6 +653,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
       goto sendit;
 
     int mret;
+
   retargeted:;
     if(retargetcount++>10) {
       L<<Logger::Error<<"Detected wildcard CNAME loop involving '"<<target<<"'"<<endl;
@@ -662,7 +663,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
     mret=makeCanonic(p, r, target); // traverse CNAME chain until we have a useful record (may actually give the correct answer!)
     DLOG(L<<Logger::Warning<<"MakeCanonic returned "<<mret<<endl);
 
-    if(mret==2) { // there is some data, but not of the correct type
+    if(mret==2 && retargetcount==1) { // there is some data, but not of the correct type
       r->clearRecords();
     }
     if(d_doFancyRecords) { // MBOXFW, URL <- fake records, emulated with MX and A
diff --git a/regression-tests/cname-and-wildcard-but-no-correct-type/command b/regression-tests/cname-and-wildcard-but-no-correct-type/command
new file mode 100755 (executable)
index 0000000..40d2783
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+cleandig yo.test.test.com AAAA
diff --git a/regression-tests/cname-and-wildcard-but-no-correct-type/description b/regression-tests/cname-and-wildcard-but-no-correct-type/description
new file mode 100644 (file)
index 0000000..6838a6b
--- /dev/null
@@ -0,0 +1,3 @@
+If a CNAME wildcard is present, and it matches, but points to a record that
+does not have the requested type, a CNAME should be emitted plus a SOA to
+indicate no match with the right record
diff --git a/regression-tests/cname-and-wildcard-but-no-correct-type/expected_result b/regression-tests/cname-and-wildcard-but-no-correct-type/expected_result
new file mode 100644 (file)
index 0000000..a28dfdf
--- /dev/null
@@ -0,0 +1,4 @@
+0      yo.test.test.com.       IN      CNAME   3600    server1.test.com.
+1      test.com.       IN      SOA     3600    ns1.test.com. ahu.example.com. 2005092501 28800 7200 604800 86400
+Rcode: 0, RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='yo.test.test.com.', qtype=AAAA