BIND 10 trac2497, updated. c73280d2ebe15512cd4f09ddbb28c2f5030cd86f [2497] Also check and stop at END_OF_LINE

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Nov 30 04:21:32 UTC 2012


The branch, trac2497 has been updated
       via  c73280d2ebe15512cd4f09ddbb28c2f5030cd86f (commit)
      from  1c4683ddcc108f12b355c5e7b5476671fa6c8a33 (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 c73280d2ebe15512cd4f09ddbb28c2f5030cd86f
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Nov 30 09:50:23 2012 +0530

    [2497] Also check and stop at END_OF_LINE

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

Summary of changes:
 src/lib/dns/rdata.cc                          |    3 ++-
 src/lib/dns/rrparamregistry-placeholder.cc    |    3 ++-
 src/lib/dns/tests/rdata_unittest.cc           |    3 ++-
 src/lib/dns/tests/rrparamregistry_unittest.cc |   31 +++++++++++++++++--------
 4 files changed, 27 insertions(+), 13 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/rdata.cc b/src/lib/dns/rdata.cc
index 06472b0..40b6d79 100644
--- a/src/lib/dns/rdata.cc
+++ b/src/lib/dns/rdata.cc
@@ -204,7 +204,8 @@ Generic::Generic(MasterLexer& lexer, const Name*,
 
     while (true) {
         const MasterLexer::Token& token = lexer.getNextToken();
-        if (token.getType() == MasterLexer::Token::END_OF_FILE) {
+        if ((token.getType() == MasterLexer::Token::END_OF_FILE) ||
+            (token.getType() == MasterLexer::Token::END_OF_LINE)) {
             break;
         }
 
diff --git a/src/lib/dns/rrparamregistry-placeholder.cc b/src/lib/dns/rrparamregistry-placeholder.cc
index e214447..e35b2f4 100644
--- a/src/lib/dns/rrparamregistry-placeholder.cc
+++ b/src/lib/dns/rrparamregistry-placeholder.cc
@@ -53,7 +53,8 @@ AbstractRdataFactory::create(MasterLexer& lexer, const Name*,
 
     while (true) {
         const MasterLexer::Token& token = lexer.getNextToken();
-        if (token.getType() == MasterLexer::Token::END_OF_FILE) {
+        if ((token.getType() == MasterLexer::Token::END_OF_FILE) ||
+            (token.getType() == MasterLexer::Token::END_OF_LINE)) {
             break;
         }
 
diff --git a/src/lib/dns/tests/rdata_unittest.cc b/src/lib/dns/tests/rdata_unittest.cc
index c80fdd0..984289c 100644
--- a/src/lib/dns/tests/rdata_unittest.cc
+++ b/src/lib/dns/tests/rdata_unittest.cc
@@ -59,7 +59,8 @@ RdataTest::rdataFactoryFromFile(const RRType& rrtype, const RRClass& rrclass,
 
 namespace test {
 
-void dummyCallback(const string&, size_t, const string&) {
+void
+dummyCallback(const string&, size_t, const string&) {
 }
 
 RdataPtr
diff --git a/src/lib/dns/tests/rrparamregistry_unittest.cc b/src/lib/dns/tests/rrparamregistry_unittest.cc
index 7e68383..b749d74 100644
--- a/src/lib/dns/tests/rrparamregistry_unittest.cc
+++ b/src/lib/dns/tests/rrparamregistry_unittest.cc
@@ -157,16 +157,15 @@ TEST_F(RRParamRegistryTest, addRemoveFactory) {
                      RRType(test_type_code)));
 }
 
-void dummyCallback(const string&, size_t, const string&) {
+void
+dummyCallback(const string&, size_t, const string&) {
 }
 
-TEST_F(RRParamRegistryTest, createFromLexer) {
-    // This test basically checks that the string version of
-    // AbstractRdataFactory::create() is called by the MasterLexer
-    // variant of create().
+RdataPtr
+createRdataHelper(const std::string& str) {
     boost::scoped_ptr<AbstractRdataFactory> rdf(new TestRdataFactory);
 
-    std::stringstream ss("192.168.0.1");
+    std::stringstream ss(str);
     MasterLexer lexer;
     lexer.pushSource(ss);
 
@@ -175,10 +174,22 @@ TEST_F(RRParamRegistryTest, createFromLexer) {
     MasterLoaderCallbacks callbacks(callback, callback);
     Name origin("example.org.");
 
-    const RdataPtr rdata = rdf->create(lexer, &origin,
-                                       MasterLoader::MANY_ERRORS,
-                                       callbacks);
-    EXPECT_EQ(0, in::A("192.168.0.1").compare(*rdata));
+    return (rdf->create(lexer, &origin,
+                        MasterLoader::MANY_ERRORS,
+                        callbacks));
+}
+
+TEST_F(RRParamRegistryTest, createFromLexer) {
+    // This test basically checks that the string version of
+    // AbstractRdataFactory::create() is called by the MasterLexer
+    // variant of create().
+    EXPECT_EQ(0, in::A("192.168.0.1").compare(
+              *createRdataHelper("192.168.0.1")));
+
+    // This should parse only up to the end of line. Everything that
+    // comes afterwards is not parsed.
+    EXPECT_EQ(0, in::A("192.168.0.42").compare(
+              *createRdataHelper("192.168.0.42\na b c d e f")));
 }
 
 }



More information about the bind10-changes mailing list