[svn] commit: r1317 - in /trunk/src/lib/auth: data_source.cc tests/datasrc_unittest.cc tests/testdata/q_wild2

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Mar 11 03:08:50 UTC 2010


Author: each
Date: Thu Mar 11 03:08:49 2010
New Revision: 1317

Log:
- handle wildcard queries correctly when there is no data of the requested type
- handle wildcard queries correctly when there is a wildcard CNAME
- added a unit test for the nodata case (still need to do one for the CNAME)

Added:
    trunk/src/lib/auth/tests/testdata/q_wild2
Modified:
    trunk/src/lib/auth/data_source.cc
    trunk/src/lib/auth/tests/datasrc_unittest.cc

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 03:08:49 2010
@@ -430,14 +430,19 @@
 
     for (int i = 1; i <= diff; ++i) {
         const Name& wname(star.concatenate(task->qname.split(i, nlen - i)));
-        QueryTask newtask(wname, task->qclass, task->qtype,
-                          QueryTask::SIMPLE_QUERY); 
+        QueryTask newtask(wname, task->qclass, task->qtype, Section::ANSWER(),
+                          QueryTask::AUTH_QUERY); 
         result = doQueryTask(ds, zonename, newtask, wild);
-        if (result == DataSrc::SUCCESS &&
-            (newtask.flags == 0 || (newtask.flags & DataSrc::CNAME_FOUND))) {
-            rflags = newtask.flags;
-            found = true;
-            break;
+        if (result == DataSrc::SUCCESS) {
+            if (newtask.flags == 0 || (newtask.flags & DataSrc::CNAME_FOUND)) {
+                rflags = newtask.flags;
+                found = true;
+                break;
+            } else if ((newtask.flags & DataSrc::TYPE_NOT_FOUND) != 0) {
+                task->flags &= ~DataSrc::NAME_NOT_FOUND;
+                task->flags |= DataSrc::TYPE_NOT_FOUND;
+                break;
+            }
         }
     }
 

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 03:08:49 2010
@@ -252,6 +252,14 @@
     EXPECT_TRUE(it->isLast());
 }
 
+TEST_F(DataSrcTest, WildcardNodata) {
+
+    // Check that a query for a data type not covered by the wildcard
+    // returns NOERROR
+    readAndProcessQuery(msg, "testdata/q_wild2");
+    headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 2, 0);
+}
+
 TEST_F(DataSrcTest, AuthDelegation) {
     readAndProcessQuery(msg, "testdata/q_sql1");
 




More information about the bind10-changes mailing list