[svn] commit: r1329 - in /trunk/src/lib/auth: data_source.cc tests/datasrc_unittest.cc tests/testdata/q_subzone_any tests/testdata/q_subzone_ns tests/testdata/q_subzone_nsec

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Mar 11 17:13:09 UTC 2010


Author: each
Date: Thu Mar 11 17:13:09 2010
New Revision: 1329

Log:
Handle NSEC queries at zone cut correctly, and add a unit test

Added:
    trunk/src/lib/auth/tests/testdata/q_subzone_nsec
Modified:
    trunk/src/lib/auth/data_source.cc
    trunk/src/lib/auth/tests/datasrc_unittest.cc
    trunk/src/lib/auth/tests/testdata/q_subzone_any
    trunk/src/lib/auth/tests/testdata/q_subzone_ns

Modified: trunk/src/lib/auth/data_source.cc
==============================================================================
--- trunk/src/lib/auth/data_source.cc (original)
+++ trunk/src/lib/auth/data_source.cc Thu Mar 11 17:13:09 2010
@@ -537,10 +537,11 @@
 
             // Query found a referral; let's find out if that was expected--
             // i.e., if an NS was at the zone apex, or if we were querying
-            // specifically for the DS or DNAME record.
+            // specifically for the DS, NSEC, or DNAME record.
             if ((task->flags & REFERRAL) != 0 &&
                 (zonename->getLabelCount() == task->qname.getLabelCount() ||
                  task->qtype == RRType::DS() ||
+                 task->qtype == RRType::NSEC() ||
                  task->qtype == RRType::DNAME())) {
                 task->flags &= ~REFERRAL;
             }

Modified: trunk/src/lib/auth/tests/datasrc_unittest.cc
==============================================================================
--- trunk/src/lib/auth/tests/datasrc_unittest.cc (original)
+++ trunk/src/lib/auth/tests/datasrc_unittest.cc Thu Mar 11 17:13:09 2010
@@ -482,7 +482,7 @@
     EXPECT_TRUE(it->isLast());
 }
 
-TEST_F(DataSrcTest, ANYDelegation) {
+TEST_F(DataSrcTest, ANYZonecut) {
     // An ANY query at a zone cut should behave the same as any other
     // delegation
     readAndProcessQuery(msg, "testdata/q_subzone_any");
@@ -510,6 +510,34 @@
     it = rrset->getRdataIterator();
     it->first();
     EXPECT_EQ("192.168.3.1", it->getCurrent().toText());
+    it->next();
+    EXPECT_TRUE(it->isLast());
+}
+
+TEST_F(DataSrcTest, NSECZonecut) {
+    readAndProcessQuery(msg, "testdata/q_subzone_nsec");
+
+    headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
+
+    RRsetIterator rit = msg.beginSection(Section::ANSWER());
+    RRsetPtr rrset = *rit;
+    EXPECT_EQ(Name("subzone.example.com."), rrset->getName());
+    EXPECT_EQ(RRType::NSEC(), rrset->getType());
+    EXPECT_EQ(RRClass::IN(), rrset->getClass());
+
+    rit = msg.beginSection(Section::AUTHORITY());
+    rrset = *rit;
+    EXPECT_EQ(Name("example.com"), rrset->getName());
+    EXPECT_EQ(RRType::NS(), rrset->getType());
+    EXPECT_EQ(RRClass::IN(), rrset->getClass());
+
+    RdataIteratorPtr it = rrset->getRdataIterator();
+    it->first();
+    EXPECT_EQ("dns01.example.com.", it->getCurrent().toText());
+    it->next();
+    EXPECT_EQ("dns02.example.com.", it->getCurrent().toText());
+    it->next();
+    EXPECT_EQ("dns03.example.com.", it->getCurrent().toText());
     it->next();
     EXPECT_TRUE(it->isLast());
 }

Modified: trunk/src/lib/auth/tests/testdata/q_subzone_any
==============================================================================
--- trunk/src/lib/auth/tests/testdata/q_subzone_any (original)
+++ trunk/src/lib/auth/tests/testdata/q_subzone_any Thu Mar 11 17:13:09 2010
@@ -1,4 +1,4 @@
-# www.subzone.example.com/A (delegation to non-local zone)
-  00 7c 01 00 00 01 00 00 00 00 00 00 03 77 77 77
-  07 73 75 62 7a 6f 6e 65 07 65 78 61 6d 70 6c 65
-  03 63 6f 6d 00 00 ff 00 01
+# subzone.example.com/ANY (ANY query at zone cut)
+  14 f0 01 00 00 01 00 00 00 00 00 00 07 73 75 62
+  7a 6f 6e 65 07 65 78 61 6d 70 6c 65 03 63 6f 6d
+  00 00 ff 00 01

Modified: trunk/src/lib/auth/tests/testdata/q_subzone_ns
==============================================================================
--- trunk/src/lib/auth/tests/testdata/q_subzone_ns (original)
+++ trunk/src/lib/auth/tests/testdata/q_subzone_ns Thu Mar 11 17:13:09 2010
@@ -1,4 +1,4 @@
-# www.subzone.example.com/NS (delegation to non-local zone)
-  00 7c 01 00 00 01 00 00 00 00 00 00 03 77 77 77
-  07 73 75 62 7a 6f 6e 65 07 65 78 61 6d 70 6c 65
-  03 63 6f 6d 00 00 02 00 01
+# subzone.example.com/NS (delegation to non-local zone)
+  14 f0 01 00 00 01 00 00 00 00 00 00 07 73 75 62
+  7a 6f 6e 65 07 65 78 61 6d 70 6c 65 03 63 6f 6d
+  00 00 02 00 01




More information about the bind10-changes mailing list