[svn] commit: r2923 - in /trunk: ChangeLog src/lib/datasrc/data_source.cc src/lib/datasrc/tests/datasrc_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Sep 14 16:51:30 UTC 2010


Author: jreed
Date: Tue Sep 14 16:51:30 2010
New Revision: 2923

Log:
>From Trac #307.
This includes revisions 2792 and 2922 plus the ChangeLog entry:

  91.  [bug]           jinmei
       lib/datasrc: A DS query could crash the library (and therefore,
       e.g. the authoritative server) if some RR of the same apex name
       is stored in the hot spot cache.  (Trac #307, svn rTBD)


Modified:
    trunk/ChangeLog
    trunk/src/lib/datasrc/data_source.cc
    trunk/src/lib/datasrc/tests/datasrc_unittest.cc

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Tue Sep 14 16:51:30 2010
@@ -1,3 +1,8 @@
+  91.	[bug]		jinmei
+	lib/datasrc: A DS query could crash the library (and therefore,
+	e.g. the authoritative server) if some RR of the same apex name
+	is stored in the hot spot cache.  (Trac #307, svn r2923)
+
   92.	[func]*		jelte
 	libdns_python (the python wrappers for libdns++) has been renamed
 	to pydnspp (Python DNS++). Programs and libraries that used

Modified: trunk/src/lib/datasrc/data_source.cc
==============================================================================
--- trunk/src/lib/datasrc/data_source.cc (original)
+++ trunk/src/lib/datasrc/data_source.cc Tue Sep 14 16:51:30 2010
@@ -206,6 +206,11 @@
         if (!hit || !rrset || (flags & DataSrc::CNAME_FOUND) != 0) {
             hit = cache.retrieve(task.qname, task.qclass, RRType::CNAME(),
                                  rrset, flags);
+            if (!rrset) {
+                // If we don't have a positive cache, forget it; otherwise the
+                // intermediate result may confuse the subsequent processing.
+                hit = false;
+            }
         }
 
         if (hit) {

Modified: trunk/src/lib/datasrc/tests/datasrc_unittest.cc
==============================================================================
--- trunk/src/lib/datasrc/tests/datasrc_unittest.cc (original)
+++ trunk/src/lib/datasrc/tests/datasrc_unittest.cc Tue Sep 14 16:51:30 2010
@@ -915,6 +915,24 @@
     headerCheck(msg, Rcode::REFUSED(), true, false, true, 0, 0, 0);
 }
 
+TEST_F(DataSrcTest, DSQueryFromCache) {
+    // explicitly enable hot spot cache
+    cache.setEnabled(true);
+
+    // The first query will create a negative cache for example.org/CNAME
+    createAndProcessQuery(Name("example.org"), RRClass::IN(), RRType::SOA());
+
+    // the cached CNAME shouldn't confuse subsequent query.
+    // there may be several different possible cases that could trigger a bug,
+    // but DS query is the only known example.
+    msg.clear(Message::PARSE);
+    createAndProcessQuery(Name("example.org"), RRClass::IN(), RRType::DS());
+
+    // returning refused is probably a bad behavior, but it's a different
+    // issue -- see Trac Ticket #306.
+    headerCheck(msg, Rcode::REFUSED(), true, false, true, 0, 0, 0);
+}
+
 // Non-existent name in the "static" data source.  The purpose of this test
 // is to check a corner case behavior when atypical RRClass (CH in this case)
 // is specified.




More information about the bind10-changes mailing list