Commit 870cc9bc authored by Paul Selkirk's avatar Paul Selkirk
Browse files

[2521] enabled previously disabled rrsig test

also changed createFromLexer from static function to private method
parent fdb992f0
...@@ -74,9 +74,8 @@ struct RRSIGImpl { ...@@ -74,9 +74,8 @@ struct RRSIGImpl {
const vector<uint8_t> signature_; const vector<uint8_t> signature_;
}; };
namespace {
// helper function for string and lexer constructors // 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; string covered_txt, expire_txt, inception_txt, signature_txt;
unsigned int algorithm, labels, tag; unsigned int algorithm, labels, tag;
...@@ -108,10 +107,9 @@ RRSIGImpl* createFromLexer(MasterLexer& lexer, const Name* origin) ...@@ -108,10 +107,9 @@ RRSIGImpl* createFromLexer(MasterLexer& lexer, const Name* origin)
vector<uint8_t> signature; vector<uint8_t> signature;
decodeBase64(signature_txt, signature); decodeBase64(signature_txt, signature);
return new RRSIGImpl(RRType(covered_txt), algorithm, labels, impl_ = new RRSIGImpl(RRType(covered_txt), algorithm, labels,
originalttl, timeexpire, timeinception, originalttl, timeexpire, timeinception,
static_cast<uint16_t>(tag), signer, signature); static_cast<uint16_t>(tag), signer, signature);
}
} }
/// \brief Constructor from string. /// \brief Constructor from string.
...@@ -138,7 +136,7 @@ RRSIG::RRSIG(const std::string& rrsig_str) : ...@@ -138,7 +136,7 @@ RRSIG::RRSIG(const std::string& rrsig_str) :
MasterLexer lexer; MasterLexer lexer;
lexer.pushSource(iss); lexer.pushSource(iss);
impl_ = createFromLexer(lexer, NULL); createFromLexer(lexer, NULL);
if (lexer.getNextToken().getType() != MasterToken::END_OF_FILE) { if (lexer.getNextToken().getType() != MasterToken::END_OF_FILE) {
isc_throw(InvalidRdataText, "extra input text for RRSIG: " isc_throw(InvalidRdataText, "extra input text for RRSIG: "
...@@ -173,7 +171,7 @@ RRSIG::RRSIG(MasterLexer& lexer, const Name* origin, ...@@ -173,7 +171,7 @@ RRSIG::RRSIG(MasterLexer& lexer, const Name* origin,
MasterLoader::Options, MasterLoaderCallbacks&) : MasterLoader::Options, MasterLoaderCallbacks&) :
impl_(NULL) impl_(NULL)
{ {
impl_ = createFromLexer(lexer, origin); createFromLexer(lexer, origin);
} }
RRSIG::RRSIG(InputBuffer& buffer, size_t rdata_len) { RRSIG::RRSIG(InputBuffer& buffer, size_t rdata_len) {
......
// 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 // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -42,6 +42,9 @@ public: ...@@ -42,6 +42,9 @@ public:
// specialized methods // specialized methods
const RRType& typeCovered() const; const RRType& typeCovered() const;
private: private:
// helper function for string and lexer constructors
void createFromLexer(MasterLexer& lexer, const Name* origin);
RRSIGImpl* impl_; RRSIGImpl* impl_;
}; };
......
...@@ -99,13 +99,10 @@ TEST_F(Rdata_RRSIG_Test, badText) { ...@@ -99,13 +99,10 @@ TEST_F(Rdata_RRSIG_Test, badText) {
"20100223214617 20100222214617 8496 isc.org. " "20100223214617 20100222214617 8496 isc.org. "
"EEeeeeeeEEEeeeeeeGaaahAAAAAAAAHHHHHHHHHHH!="), "EEeeeeeeEEEeeeeeeGaaahAAAAAAAAHHHHHHHHHHH!="),
BadValue); BadValue);
}
TEST_F(Rdata_RRSIG_Test, DISABLED_badText) {
// this currently fails
// no space between the tag and signer // no space between the tag and signer
EXPECT_THROW(generic::RRSIG("A 5 4 43200 20100223214617 20100222214617 " EXPECT_THROW(const generic::RRSIG sig(
"8496isc.org. ofc="), InvalidRdataText); "A 5 4 43200 20100223214617 20100222214617 "
"8496isc.org. ofc="), InvalidRdataText);
} }
TEST_F(Rdata_RRSIG_Test, createFromLexer) { TEST_F(Rdata_RRSIG_Test, createFromLexer) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment