]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2108] Check that loading a zone containing NSEC3 names with invalid number of labels...
authorMukund Sivaraman <muks@isc.org>
Mon, 10 Sep 2012 01:58:37 +0000 (07:28 +0530)
committerMukund Sivaraman <muks@isc.org>
Mon, 10 Sep 2012 02:01:18 +0000 (07:31 +0530)
src/lib/datasrc/memory/tests/memory_client_unittest.cc
src/lib/datasrc/memory/tests/testdata/Makefile.am
src/lib/datasrc/memory/tests/testdata/example.org-nsec3-fewer-labels.zone [new file with mode: 0644]
src/lib/datasrc/memory/tests/testdata/example.org-nsec3-more-labels.zone [new file with mode: 0644]

index 2bcb3f77064282df6339981e828ef7231b68de9c..032b9654a40e95e83ba25f8422a4bc49a50c087f 100644 (file)
@@ -317,6 +317,24 @@ TEST_F(MemoryClientTest, loadWildcardNSEC3Throws) {
     // Teardown checks for memory segment leaks
 }
 
+TEST_F(MemoryClientTest, loadNSEC3WithFewerLabelsThrows) {
+    // NSEC3 names with labels != (origin_labels + 1) should throw
+    EXPECT_THROW(client_->load(Name("example.org"),
+                               TEST_DATA_DIR
+                               "/example.org-nsec3-fewer-labels.zone"),
+                 InMemoryClient::AddError);
+    // Teardown checks for memory segment leaks
+}
+
+TEST_F(MemoryClientTest, loadNSEC3WithMoreLabelsThrows) {
+    // NSEC3 names with labels != (origin_labels + 1) should throw
+    EXPECT_THROW(client_->load(Name("example.org"),
+                               TEST_DATA_DIR
+                               "/example.org-nsec3-more-labels.zone"),
+                 InMemoryClient::AddError);
+    // Teardown checks for memory segment leaks
+}
+
 TEST_F(MemoryClientTest, loadRRSIGFollowsNothing) {
     EXPECT_THROW(client_->load(Name("example.org"),
                                TEST_DATA_DIR
index 02a23e1eb7b26aebb310afa7be9cd303656ab916..721448a416f02c95fc9caa56ee4ab1581c03fe40 100644 (file)
@@ -21,3 +21,5 @@ EXTRA_DIST += example.org-out-of-zone.zone
 EXTRA_DIST += example.org-wildcard-ns.zone
 EXTRA_DIST += example.org-wildcard-dname.zone
 EXTRA_DIST += example.org-wildcard-nsec3.zone
+EXTRA_DIST += example.org-nsec3-fewer-labels.zone
+EXTRA_DIST += example.org-nsec3-more-labels.zone
diff --git a/src/lib/datasrc/memory/tests/testdata/example.org-nsec3-fewer-labels.zone b/src/lib/datasrc/memory/tests/testdata/example.org-nsec3-fewer-labels.zone
new file mode 100644 (file)
index 0000000..0221269
--- /dev/null
@@ -0,0 +1,3 @@
+;; NSEC3 names with labels != (origin_labels + 1)
+example.org.                                 86400 IN SOA      ns.example.org. ns.example.org. 2012091001 7200 3600 2592000 1200
+example.org. 1200 IN NSEC3     1 0 10 AABBCCDD RKOF8QMFRB5F2V9EJHFBVB2JPVSA0DJD A RRSIG
diff --git a/src/lib/datasrc/memory/tests/testdata/example.org-nsec3-more-labels.zone b/src/lib/datasrc/memory/tests/testdata/example.org-nsec3-more-labels.zone
new file mode 100644 (file)
index 0000000..efebcfb
--- /dev/null
@@ -0,0 +1,3 @@
+;; NSEC3 names with labels != (origin_labels + 1)
+example.org.                                 86400 IN SOA      ns.example.org. ns.example.org. 2012091002 7200 3600 2592000 1200
+a.b.example.org. 1200 IN NSEC3 1 0 10 AABBCCDD RKOF8QMFRB5F2V9EJHFBVB2JPVSA0DJD A RRSIG