]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1574b] test the case of adding NSEC3PARAM at non origin
authorJINMEI Tatuya <jinmei@isc.org>
Tue, 31 Jan 2012 04:57:44 +0000 (20:57 -0800)
committerJINMEI Tatuya <jinmei@isc.org>
Tue, 31 Jan 2012 04:57:44 +0000 (20:57 -0800)
src/lib/datasrc/memory_datasrc.cc
src/lib/datasrc/tests/memory_datasrc_unittest.cc

index 126d52eebbd366d3e5caaaa9d310dd13a9750ba2..7e4bdf8f4f87e94167201f22bda2c79085c3fced 100644 (file)
@@ -476,9 +476,10 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
                 node->setFlag(DomainNode::FLAG_CALLBACK);
             }
 
-            // If we've added NSEC3PARAM, set up NSEC3 specific data or check
-            // consistency with already set up parameters.
-            if (rrset->getType() == RRType::NSEC3PARAM()) {
+            // If we've added NSEC3PARAM at zone origin, set up NSEC3 specific
+            // data or check consistency with already set up parameters.
+            if (rrset->getType() == RRType::NSEC3PARAM() &&
+                rrset->getName() == origin_) {
                 // We know rrset has exactly one RDATA
                 const generic::NSEC3PARAM& param =
                     dynamic_cast<const generic::NSEC3PARAM&>(
index 08e414ee9527ee1e0046aa0e584a20bdffe20e8c..c0c283fdf5727eab8016ea493122843393b452a7 100644 (file)
@@ -1531,7 +1531,18 @@ TEST_F(InMemoryZoneFinderTest, multiNSEC3PARAM) {
     EXPECT_THROW(zone_finder_.add(nsec3param), InMemoryZoneFinder::AddError);
 }
 
+TEST_F(InMemoryZoneFinderTest, nonOriginNSEC3PARAM) {
+    // This is a normal NSEC3PARAM at the zone origin
+    EXPECT_EQ(result::SUCCESS,
+              zone_finder_.add(textToRRset("example.org. 300 IN NSEC3PARAM "
+                                           "1 0 12 aabbccdd")));
+    // Add another (with different param) at a non origin node.  This is
+    // awkward, but the implementation accepts it as an ordinary RR.
+    EXPECT_EQ(result::SUCCESS,
+              zone_finder_.add(textToRRset("a.example.org. 300 IN NSEC3PARAM "
+                                           "1 1 1 aabbccdd")));
+}
+
 // TODO
 // - existence of NSEC3PARAM
-// - add NSEC3PARAM at non origin (should be ignored)
 }