BIND 10 trac2390_2, updated. 691f87a3076fba4d5ce60a0960c1c07a35055e05 [2390] Add NS, MX, PTR tests for extra text at end-of-line

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jan 30 06:08:32 UTC 2013


The branch, trac2390_2 has been updated
       via  691f87a3076fba4d5ce60a0960c1c07a35055e05 (commit)
      from  e6603386c50335787bca7443a9716414cf68c7bc (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 691f87a3076fba4d5ce60a0960c1c07a35055e05
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Jan 30 11:20:59 2013 +0530

    [2390] Add NS, MX, PTR tests for extra text at end-of-line

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

Summary of changes:
 src/lib/dns/tests/rdata_mx_unittest.cc  |    7 +++++++
 src/lib/dns/tests/rdata_ns_unittest.cc  |    9 +++++++++
 src/lib/dns/tests/rdata_ptr_unittest.cc |    8 ++++++++
 3 files changed, 24 insertions(+)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/tests/rdata_mx_unittest.cc b/src/lib/dns/tests/rdata_mx_unittest.cc
index e1ae811..475f65b 100644
--- a/src/lib/dns/tests/rdata_mx_unittest.cc
+++ b/src/lib/dns/tests/rdata_mx_unittest.cc
@@ -51,6 +51,9 @@ TEST_F(Rdata_MX_Test, badText) {
     // No origin and relative
     EXPECT_THROW(const generic::MX rdata_mx("10 mx.example.com"),
                  MissingNameOrigin);
+    // Extra text at end of line
+    EXPECT_THROW(const generic::MX rdata_mx("10 mx.example.com. extra."),
+                 InvalidRdataText);
 }
 
 TEST_F(Rdata_MX_Test, copy) {
@@ -77,6 +80,10 @@ TEST_F(Rdata_MX_Test, createFromLexer) {
     // 65536 is larger than maximum possible preference
     EXPECT_FALSE(test::createRdataUsingLexer(RRType::MX(), RRClass::IN(),
                                              "65536 mx.example.com."));
+
+    // Extra text at end of line
+    EXPECT_FALSE(test::createRdataUsingLexer(RRType::MX(), RRClass::IN(),
+                                             "10 mx.example.com. extra."));
 }
 
 TEST_F(Rdata_MX_Test, toWireRenderer) {
diff --git a/src/lib/dns/tests/rdata_ns_unittest.cc b/src/lib/dns/tests/rdata_ns_unittest.cc
index 087d345..980b56c 100644
--- a/src/lib/dns/tests/rdata_ns_unittest.cc
+++ b/src/lib/dns/tests/rdata_ns_unittest.cc
@@ -61,6 +61,11 @@ TEST_F(Rdata_NS_Test, createFromText) {
                                                "ns.example.com.")));
 }
 
+TEST_F(Rdata_NS_Test, badText) {
+    // Extra input at end of line
+    EXPECT_THROW(generic::NS("ns.example.com. extra."), InvalidRdataText);
+}
+
 TEST_F(Rdata_NS_Test, createFromWire) {
     EXPECT_EQ(0, rdata_ns.compare(
                   *rdataFactoryFromFile(RRType("NS"), RRClass("IN"),
@@ -94,6 +99,10 @@ TEST_F(Rdata_NS_Test, createFromLexer) {
     // Exceptions cause NULL to be returned.
     EXPECT_FALSE(test::createRdataUsingLexer(RRType::NS(), RRClass::IN(),
                                              ""));
+
+    // Extra input at end of line
+    EXPECT_FALSE(test::createRdataUsingLexer(RRType::NS(), RRClass::IN(),
+                                             "ns.example.com. extra."));
 }
 
 TEST_F(Rdata_NS_Test, toWireBuffer) {
diff --git a/src/lib/dns/tests/rdata_ptr_unittest.cc b/src/lib/dns/tests/rdata_ptr_unittest.cc
index 0297bf0..4da26df 100644
--- a/src/lib/dns/tests/rdata_ptr_unittest.cc
+++ b/src/lib/dns/tests/rdata_ptr_unittest.cc
@@ -65,6 +65,11 @@ TEST_F(Rdata_PTR_Test, createFromText) {
                                                "ns.example.com.")));
 }
 
+TEST_F(Rdata_PTR_Test, badText) {
+    // Extra text at end of line
+    EXPECT_THROW(generic::PTR("foo.example.com. extra."), InvalidRdataText);
+}
+
 TEST_F(Rdata_PTR_Test, createFromWire) {
     EXPECT_EQ(0, rdata_ptr.compare(
                   *rdataFactoryFromFile(RRType("PTR"), RRClass("IN"),
@@ -94,6 +99,9 @@ TEST_F(Rdata_PTR_Test, createFromLexer) {
     EXPECT_EQ(0, rdata_ptr.compare(
         *test::createRdataUsingLexer(RRType::PTR(), RRClass::IN(),
                                      "ns.example.com.")));
+    // Extra text at end of line
+    EXPECT_FALSE(test::createRdataUsingLexer(RRType::PTR(), RRClass::IN(),
+                                             "foo.example.com. extra."));
 }
 
 TEST_F(Rdata_PTR_Test, toWireBuffer) {



More information about the bind10-changes mailing list