BIND 10 trac2124, updated. d75a744fcd766bdedc2e7c49890c80c3606e3550 [2124] Add another wiredata test with short fingerprint data

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Jul 24 05:32:50 UTC 2012


The branch, trac2124 has been updated
       via  d75a744fcd766bdedc2e7c49890c80c3606e3550 (commit)
       via  6efceeee9d4af8525513e9701d975a9f1bf57eb0 (commit)
       via  67872ac4ab32dd0bf8dcc02d724b84f8aab87413 (commit)
      from  5e7af00c87fdb082fcaf024727de244a822513c5 (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 d75a744fcd766bdedc2e7c49890c80c3606e3550
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Jul 24 10:57:10 2012 +0530

    [2124] Add another wiredata test with short fingerprint data

commit 6efceeee9d4af8525513e9701d975a9f1bf57eb0
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Jul 24 10:44:41 2012 +0530

    [2124] Remove default values from wiredata spec files

commit 67872ac4ab32dd0bf8dcc02d724b84f8aab87413
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Jul 24 10:42:54 2012 +0530

    [2124] Allow algorithm=0 and fingerprint-type=0

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

Summary of changes:
 src/lib/dns/rdata/generic/sshfp_44.cc              |   20 ++----------------
 src/lib/dns/tests/rdata_sshfp_unittest.cc          |   22 ++++++++++----------
 src/lib/dns/tests/testdata/.gitignore              |    1 +
 src/lib/dns/tests/testdata/Makefile.am             |    4 ++--
 .../dns/tests/testdata/rdata_sshfp_fromWire3.spec  |    1 -
 .../dns/tests/testdata/rdata_sshfp_fromWire4.spec  |    1 -
 .../dns/tests/testdata/rdata_sshfp_fromWire5.spec  |    1 -
 .../dns/tests/testdata/rdata_sshfp_fromWire6.spec  |    1 -
 .../dns/tests/testdata/rdata_sshfp_fromWire7.spec  |    1 -
 ...p_fromWire7.spec => rdata_sshfp_fromWire8.spec} |    2 +-
 10 files changed, 17 insertions(+), 37 deletions(-)
 copy src/lib/dns/tests/testdata/{rdata_sshfp_fromWire7.spec => rdata_sshfp_fromWire8.spec} (61%)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/rdata/generic/sshfp_44.cc b/src/lib/dns/rdata/generic/sshfp_44.cc
index ef69789..b4175b8 100644
--- a/src/lib/dns/rdata/generic/sshfp_44.cc
+++ b/src/lib/dns/rdata/generic/sshfp_44.cc
@@ -43,14 +43,6 @@ SSHFP::SSHFP(InputBuffer& buffer, size_t rdata_len) {
     algorithm_ = buffer.readUint8();
     fingerprint_type_ = buffer.readUint8();
 
-    if (algorithm_ < 1) {
-        isc_throw(InvalidRdataText, "SSHFP algorithm number out of range");
-    }
-
-    if (fingerprint_type_ < 1) {
-        isc_throw(InvalidRdataText, "SSHFP fingerprint type out of range");
-    }
-
     rdata_len -= 2;
     fingerprint_.resize(rdata_len);
     buffer.readData(&fingerprint_[0], rdata_len);
@@ -68,11 +60,11 @@ SSHFP::SSHFP(const std::string& sshfp_str) {
         isc_throw(InvalidRdataText, "Invalid SSHFP text");
     }
 
-    if ((algorithm < 1) || (algorithm > 255)) {
+    if (algorithm > 255) {
         isc_throw(InvalidRdataText, "SSHFP algorithm number out of range");
     }
 
-    if ((fingerprint_type < 1) || (fingerprint_type > 255)) {
+    if (fingerprint_type > 255) {
         isc_throw(InvalidRdataText, "SSHFP fingerprint type out of range");
     }
 
@@ -96,14 +88,6 @@ SSHFP::SSHFP(const std::string& sshfp_str) {
 SSHFP::SSHFP(uint8_t algorithm, uint8_t fingerprint_type,
              const std::string& fingerprint)
 {
-    if (algorithm < 1) {
-        isc_throw(InvalidRdataText, "SSHFP algorithm number out of range");
-    }
-
-    if (fingerprint_type < 1) {
-        isc_throw(InvalidRdataText, "SSHFP fingerprint type out of range");
-    }
-
     algorithm_ = algorithm;
     fingerprint_type_ = fingerprint_type;
 
diff --git a/src/lib/dns/tests/rdata_sshfp_unittest.cc b/src/lib/dns/tests/rdata_sshfp_unittest.cc
index 79d1d66..7759bfd 100644
--- a/src/lib/dns/tests/rdata_sshfp_unittest.cc
+++ b/src/lib/dns/tests/rdata_sshfp_unittest.cc
@@ -71,11 +71,9 @@ TEST_F(Rdata_SSHFP_Test, algorithmTypes) {
     EXPECT_NO_THROW(const generic::SSHFP rdata_sshfp("1 128 12ab"));
     EXPECT_NO_THROW(const generic::SSHFP rdata_sshfp("1 255 12ab"));
 
-    // 0 is still reserved.
-    EXPECT_THROW(const generic::SSHFP rdata_sshfp("0 1 12ab"),
-                 InvalidRdataText);
-    EXPECT_THROW(const generic::SSHFP rdata_sshfp("1 0 12ab"),
-                 InvalidRdataText);
+    // 0 is reserved, but we allow that too
+    EXPECT_NO_THROW(const generic::SSHFP rdata_sshfp("0 1 12ab"));
+    EXPECT_NO_THROW(const generic::SSHFP rdata_sshfp("1 0 12ab"));
 
     // > 255 would be broken
     EXPECT_THROW(const generic::SSHFP rdata_sshfp("256 1 12ab"),
@@ -114,18 +112,20 @@ TEST_F(Rdata_SSHFP_Test, createFromWire) {
                                          "rdata_sshfp_fromWire4.wire"));
 
     // algorithm=0, fingerprint=1
-    EXPECT_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
-                                      "rdata_sshfp_fromWire5.wire"),
-                 InvalidRdataText);
+    EXPECT_NO_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+                                         "rdata_sshfp_fromWire5.wire"));
 
     // algorithm=5, fingerprint=0
-    EXPECT_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
-                                      "rdata_sshfp_fromWire6.wire"),
-                 InvalidRdataText);
+    EXPECT_NO_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+                                         "rdata_sshfp_fromWire6.wire"));
 
     // algorithm=255, fingerprint=255
     EXPECT_NO_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
                                          "rdata_sshfp_fromWire7.wire"));
+
+    // short fingerprint data
+    EXPECT_NO_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+                                         "rdata_sshfp_fromWire8.wire"));
 }
 
 TEST_F(Rdata_SSHFP_Test, toText) {
diff --git a/src/lib/dns/tests/testdata/.gitignore b/src/lib/dns/tests/testdata/.gitignore
index 5b217a8..e8879e1 100644
--- a/src/lib/dns/tests/testdata/.gitignore
+++ b/src/lib/dns/tests/testdata/.gitignore
@@ -84,6 +84,7 @@
 /rdata_sshfp_fromWire5.wire
 /rdata_sshfp_fromWire6.wire
 /rdata_sshfp_fromWire7.wire
+/rdata_sshfp_fromWire8.wire
 /rdata_tsig_fromWire1.wire
 /rdata_tsig_fromWire2.wire
 /rdata_tsig_fromWire3.wire
diff --git a/src/lib/dns/tests/testdata/Makefile.am b/src/lib/dns/tests/testdata/Makefile.am
index d4f95fb..86de476 100644
--- a/src/lib/dns/tests/testdata/Makefile.am
+++ b/src/lib/dns/tests/testdata/Makefile.am
@@ -47,7 +47,7 @@ BUILT_SOURCES += rdata_rp_toWire1.wire rdata_rp_toWire2.wire
 BUILT_SOURCES += rdata_sshfp_fromWire1.wire rdata_sshfp_fromWire2.wire
 BUILT_SOURCES += rdata_sshfp_fromWire3.wire rdata_sshfp_fromWire4.wire
 BUILT_SOURCES += rdata_sshfp_fromWire5.wire rdata_sshfp_fromWire6.wire
-BUILT_SOURCES += rdata_sshfp_fromWire7.wire
+BUILT_SOURCES += rdata_sshfp_fromWire7.wire rdata_sshfp_fromWire8.wire
 BUILT_SOURCES += rdata_afsdb_fromWire1.wire rdata_afsdb_fromWire2.wire
 BUILT_SOURCES += rdata_afsdb_fromWire3.wire rdata_afsdb_fromWire4.wire
 BUILT_SOURCES += rdata_afsdb_fromWire5.wire
@@ -134,7 +134,7 @@ EXTRA_DIST += rdata_sshfp_fromWire rdata_sshfp_fromWire2
 EXTRA_DIST += rdata_sshfp_fromWire1.spec rdata_sshfp_fromWire2.spec
 EXTRA_DIST += rdata_sshfp_fromWire3.spec rdata_sshfp_fromWire4.spec
 EXTRA_DIST += rdata_sshfp_fromWire5.spec rdata_sshfp_fromWire6.spec
-EXTRA_DIST += rdata_sshfp_fromWire7.spec
+EXTRA_DIST += rdata_sshfp_fromWire7.spec rdata_sshfp_fromWire8.spec
 EXTRA_DIST += rdata_afsdb_fromWire1.spec rdata_afsdb_fromWire2.spec
 EXTRA_DIST += rdata_afsdb_fromWire3.spec rdata_afsdb_fromWire4.spec
 EXTRA_DIST += rdata_afsdb_fromWire5.spec
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire3.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire3.spec
index bf80ec4..d111afd 100644
--- a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire3.spec
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire3.spec
@@ -4,6 +4,5 @@
 [custom]
 sections: sshfp
 [sshfp]
-fingerprint: 123456789abcdef67890123456789abcdef67890
 algorithm: 1
 fingerprint_type: 1
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire4.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire4.spec
index 965c746..b9b2658 100644
--- a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire4.spec
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire4.spec
@@ -4,6 +4,5 @@
 [custom]
 sections: sshfp
 [sshfp]
-fingerprint: 123456789abcdef67890123456789abcdef67890
 algorithm: 255
 fingerprint_type: 1
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire5.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire5.spec
index 1aff335..b3a19fa 100644
--- a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire5.spec
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire5.spec
@@ -4,6 +4,5 @@
 [custom]
 sections: sshfp
 [sshfp]
-fingerprint: 123456789abcdef67890123456789abcdef67890
 algorithm: 0
 fingerprint_type: 1
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire6.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire6.spec
index f71d155..437e282 100644
--- a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire6.spec
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire6.spec
@@ -4,6 +4,5 @@
 [custom]
 sections: sshfp
 [sshfp]
-fingerprint: 123456789abcdef67890123456789abcdef67890
 algorithm: 5
 fingerprint_type: 0
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire7.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire7.spec
index 6fc63e9..8e21d11 100644
--- a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire7.spec
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire7.spec
@@ -4,6 +4,5 @@
 [custom]
 sections: sshfp
 [sshfp]
-fingerprint: 123456789abcdef67890123456789abcdef67890
 algorithm: 255
 fingerprint_type: 255
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire8.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire8.spec
new file mode 100644
index 0000000..98aa00f
--- /dev/null
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire8.spec
@@ -0,0 +1,9 @@
+#
+# SSHFP RDATA
+#
+[custom]
+sections: sshfp
+[sshfp]
+fingerprint: 082359342fd9
+algorithm: 255
+fingerprint_type: 255



More information about the bind10-changes mailing list