]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1806] removed double nsec_signed_ && FIND_DNSSEC check
authorJelte Jansen <jelte@isc.org>
Wed, 9 May 2012 12:41:12 +0000 (14:41 +0200)
committerJelte Jansen <jelte@isc.org>
Wed, 9 May 2012 12:41:12 +0000 (14:41 +0200)
also added an extra sanity check

src/lib/datasrc/memory_datasrc.cc
src/lib/datasrc/tests/memory_datasrc_unittest.cc

index b30c86900a6a87c0e0902a0d000e3ff013f989da..e1879ee95a2cf34cb962e2fd9067b61ee87a33e0 100644 (file)
@@ -437,13 +437,10 @@ ZoneData::findNode(const Name& name, RBTreeNodeChain<Domain>& node_path,
         if (node_path.getLastComparisonResult().getRelation() ==
             NameComparisonResult::SUPERDOMAIN) { // empty node, so NXRRSET
             LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_SUPER_STOP).arg(name);
-            if (nsec_signed_ && (options & ZoneFinder::FIND_DNSSEC) != 0) {
-                return (ResultType(ZoneFinder::NXRRSET, node,
-                                   getClosestNSEC(node_path, options)));
-            } else {
-                return (ResultType(ZoneFinder::NXRRSET, node,
-                                   ConstRBNodeRRsetPtr()));
-            }
+            // getClosestNSEC returns empty node for non-NSEC zones or if
+            // option FIND_DNSSEC is not set, so no need to check here
+            return (ResultType(ZoneFinder::NXRRSET, node,
+                               getClosestNSEC(node_path, options)));
         }
         if (node->getFlag(domain_flag::WILD)) { // maybe a wildcard
             if (node_path.getLastComparisonResult().getRelation() ==
index 12339706fbb126e7a1ef194869ded5ce21210239..3b9a2f204e298c94c814d632779bb520eef04795 100644 (file)
@@ -1049,9 +1049,13 @@ TEST_F(InMemoryZoneFinderTest,findNSECEmptyNonterminal) {
     zone_finder_.add(rr_ent_);
     const Name ent_name = Name("ent.example.org");
 
-    // Should result in NXRRSET
+    // Sanity check: Should result in NXRRSET
     findTest(ent_name, RRType::A(), ZoneFinder::NXRRSET, true,
              ConstRRsetPtr());
+    // Sanity check: No NSEC added yet
+    findTest(ent_name, RRType::A(), ZoneFinder::NXRRSET, true,
+             ConstRRsetPtr(), ZoneFinder::RESULT_DEFAULT,
+             NULL, ZoneFinder::FIND_DNSSEC);
 
     zone_finder_.add(rr_ent_nsec_);
     // Should result in NXRRSET, and RESULT_NSEC_SIGNED