BIND 10 master, updated. b1e8bf0d957426abf9aacaa992e966ef0c6aac81 [master] Merge branch 'trac1893'

BIND 10 source code commits bind10-changes at lists.isc.org
Tue May 15 20:33:55 UTC 2012


The branch, master has been updated
       via  b1e8bf0d957426abf9aacaa992e966ef0c6aac81 (commit)
       via  e9506d53ade201b4808ab5e083c028a835c0dcba (commit)
       via  7fb1cf498139c61f673faeeaa6f487fcdd0b503a (commit)
       via  60899bcd88a05293f18143f769a418ec34630cf8 (commit)
      from  c7a5a56e8269ad841c1b43a635fc3c49ea254638 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b1e8bf0d957426abf9aacaa992e966ef0c6aac81
Merge: c7a5a56 e9506d5
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue May 15 13:31:56 2012 -0700

    [master] Merge branch 'trac1893'

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/tests/database_unittest.cc |   72 ++++++++++++++++++++--------
 src/lib/datasrc/tests/faked_nsec3.cc       |    2 +-
 2 files changed, 52 insertions(+), 22 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index 110b3f0..a0a9ca8 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -214,6 +214,15 @@ const char* const TEST_RECORDS[][5] = {
     {NULL, NULL, NULL, NULL, NULL},
 };
 
+// NSEC3PARAM at the zone origin and its RRSIG.  These will be added
+// separately for some NSEC3 related tests.
+const char* TEST_NSEC3PARAM_RECORDS[][5] = {
+    {"example.org.", "NSEC3PARAM", "3600", "", "1 0 12 aabbccdd"},
+    {"example.org.", "RRSIG", "3600", "", "NSEC3PARAM 5 3 3600 20000101000000 "
+     "20000201000000 12345 example.org. FAKEFAKEFAKE"},
+    {NULL, NULL, NULL, NULL, NULL}
+};
+
 // FIXME: Taken from a different test. Fill with proper data when creating a test.
 const char* TEST_NSEC3_RECORDS[][5] = {
     {apex_hash, "NSEC3", "300", "", "1 1 12 AABBCCDD 2T7B4G4VSA5SMI47K61MV5BV1A22BOJR A RRSIG"},
@@ -1065,24 +1074,15 @@ public:
     // tests. Note that the NSEC3 namespace is available in other tests, but
     // it should not be accessed at that time.
     void enableNSEC3() {
-        // We place the signature first, so it's in the block with the other
-        // signatures
-        vector<string> signature;
-        signature.push_back("RRSIG");
-        signature.push_back("3600");
-        signature.push_back("");
-        signature.push_back("NSEC3PARAM 5 3 3600 20000101000000 20000201000000 "
-                            "12345 example.org. FAKEFAKEFAKE");
-        signature.push_back("exmaple.org.");
-        (*readonly_records_)["example.org."].push_back(signature);
-        // Now the NSEC3 param itself
-        vector<string> param;
-        param.push_back("NSEC3PARAM");
-        param.push_back("3600");
-        param.push_back("");
-        param.push_back("1 0 12 aabbccdd");
-        param.push_back("example.org.");
-        (*readonly_records_)["example.org."].push_back(param);
+        for (int i = 0; TEST_NSEC3PARAM_RECORDS[i][0] != NULL; ++i) {
+            vector<string> param;
+            param.push_back(TEST_NSEC3PARAM_RECORDS[i][1]); // RRtype
+            param.push_back(TEST_NSEC3PARAM_RECORDS[i][2]); // TTL
+            param.push_back("");                            // sigtype, unused
+            param.push_back(TEST_NSEC3PARAM_RECORDS[i][4]); // RDATA
+            param.push_back(TEST_NSEC3PARAM_RECORDS[i][0]); // owner name
+            (*readonly_records_)[param.back()].push_back(param);
+        }
     }
 };
 
@@ -1324,6 +1324,36 @@ public:
 
             addRecordToZone(columns);
         }
+        // We don't add NSEC3s until we are explicitly told we need them
+        // in enableNSEC3(); these would break some non NSEC3 tests.
+        commit();
+    }
+
+    void enableNSEC3() {
+        startUpdateZone("example.org.", false);
+
+        // Add NSECPARAM at the zone origin
+        for (int i = 0; TEST_NSEC3PARAM_RECORDS[i][0] != NULL; ++i) {
+            const string param_columns[ADD_COLUMN_COUNT] = {
+                TEST_NSEC3PARAM_RECORDS[i][0], // name
+                Name(param_columns[ADD_NAME]).reverse().toText(), // revname
+                TEST_NSEC3PARAM_RECORDS[i][2],   // TTL
+                TEST_NSEC3PARAM_RECORDS[i][1],   // RR type
+                TEST_NSEC3PARAM_RECORDS[i][3],   // sigtype
+                TEST_NSEC3PARAM_RECORDS[i][4] }; // RDATA
+            addRecordToZone(param_columns);
+        }
+
+        // Add NSEC3s
+        for (int i = 0; TEST_NSEC3_RECORDS[i][0] != NULL; ++i) {
+            const string nsec3_columns[ADD_NSEC3_COLUMN_COUNT] = {
+                Name(TEST_NSEC3_RECORDS[i][0]).split(0, 1).toText(true),
+                TEST_NSEC3_RECORDS[i][2], // TTL
+                TEST_NSEC3_RECORDS[i][1], // RR type
+                TEST_NSEC3_RECORDS[i][4] }; // RDATA
+            addNSEC3RecordToZone(nsec3_columns);
+        }
+
         commit();
     }
 };
@@ -3975,11 +4005,11 @@ TEST_F(MockDatabaseClientTest, journalWithBadData) {
 }
 
 /// Let us test a little bit of NSEC3.
-TEST_F(MockDatabaseClientTest, findNSEC3) {
+TYPED_TEST(DatabaseClientTest, findNSEC3) {
     // Set up the faked hash calculator.
-    setNSEC3HashCreator(&test_nsec3_hash_creator_);
+    setNSEC3HashCreator(&this->test_nsec3_hash_creator_);
 
-    DataSourceClient::FindResult
+    const DataSourceClient::FindResult
         zone(this->client_->findZone(Name("example.org")));
     ASSERT_EQ(result::SUCCESS, zone.code);
     boost::shared_ptr<DatabaseClient::Finder> finder(
diff --git a/src/lib/datasrc/tests/faked_nsec3.cc b/src/lib/datasrc/tests/faked_nsec3.cc
index 0a1823b..1e37b8e 100644
--- a/src/lib/datasrc/tests/faked_nsec3.cc
+++ b/src/lib/datasrc/tests/faked_nsec3.cc
@@ -130,7 +130,7 @@ performNSEC3Test(ZoneFinder &finder) {
     EXPECT_THROW(finder.findNSEC3(Name("example.com"), false), OutOfZone);
     EXPECT_THROW(finder.findNSEC3(Name("org"), true), OutOfZone);
 
-    Name origin("example.org");
+    const Name origin("example.org");
     const string apex_nsec3_text = string(apex_hash) + ".example.org." +
         string(nsec3_common);
     const string ns1_nsec3_text = string(ns1_hash) + ".example.org." +



More information about the bind10-changes mailing list