Browse Source

[2521] enabled previously disabled rrsig test

also changed createFromLexer from static function to private method
Paul Selkirk 12 years ago
parent
commit
870cc9bca3

+ 6 - 8
src/lib/dns/rdata/generic/rrsig_46.cc

@@ -74,9 +74,8 @@ struct RRSIGImpl {
     const vector<uint8_t> signature_;
 };
 
-namespace {
 // helper function for string and lexer constructors
-RRSIGImpl* createFromLexer(MasterLexer& lexer, const Name* origin)
+void RRSIG::createFromLexer(MasterLexer& lexer, const Name* origin)
 {
     string covered_txt, expire_txt, inception_txt, signature_txt;
     unsigned int algorithm, labels, tag;
@@ -108,10 +107,9 @@ RRSIGImpl* createFromLexer(MasterLexer& lexer, const Name* origin)
     vector<uint8_t> signature;
     decodeBase64(signature_txt, signature);
 
-    return new RRSIGImpl(RRType(covered_txt), algorithm, labels,
-                         originalttl, timeexpire, timeinception,
-			 static_cast<uint16_t>(tag), signer, signature);
-}
+    impl_ = new RRSIGImpl(RRType(covered_txt), algorithm, labels,
+			  originalttl, timeexpire, timeinception,
+			  static_cast<uint16_t>(tag), signer, signature);
 }
 
 /// \brief Constructor from string.
@@ -138,7 +136,7 @@ RRSIG::RRSIG(const std::string& rrsig_str) :
         MasterLexer lexer;
         lexer.pushSource(iss);
 
-        impl_ = createFromLexer(lexer, NULL);
+        createFromLexer(lexer, NULL);
 
         if (lexer.getNextToken().getType() != MasterToken::END_OF_FILE) {
             isc_throw(InvalidRdataText, "extra input text for RRSIG: "
@@ -173,7 +171,7 @@ RRSIG::RRSIG(MasterLexer& lexer, const Name* origin,
              MasterLoader::Options, MasterLoaderCallbacks&) :
     impl_(NULL)
 {
-    impl_ = createFromLexer(lexer, origin);
+    createFromLexer(lexer, origin);
 }
 
 RRSIG::RRSIG(InputBuffer& buffer, size_t rdata_len) {

+ 4 - 1
src/lib/dns/rdata/generic/rrsig_46.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2010  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2013  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -42,6 +42,9 @@ public:
     // specialized methods
     const RRType& typeCovered() const;
 private:
+    // helper function for string and lexer constructors
+    void createFromLexer(MasterLexer& lexer, const Name* origin);
+
     RRSIGImpl* impl_;
 };
 

+ 3 - 6
src/lib/dns/tests/rdata_rrsig_unittest.cc

@@ -99,13 +99,10 @@ TEST_F(Rdata_RRSIG_Test, badText) {
                      "20100223214617 20100222214617 8496 isc.org. "
                      "EEeeeeeeEEEeeeeeeGaaahAAAAAAAAHHHHHHHHHHH!="),
                  BadValue);
-}
-
-TEST_F(Rdata_RRSIG_Test, DISABLED_badText) {
-    // this currently fails
     // no space between the tag and signer
-    EXPECT_THROW(generic::RRSIG("A 5 4 43200 20100223214617 20100222214617 "
-                                "8496isc.org. ofc="), InvalidRdataText);
+    EXPECT_THROW(const generic::RRSIG sig(
+                     "A 5 4 43200 20100223214617 20100222214617 "
+                     "8496isc.org. ofc="), InvalidRdataText);
 }
 
 TEST_F(Rdata_RRSIG_Test, createFromLexer) {