summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/lib/dns/gen-rdatacode.py.in2
-rw-r--r--src/lib/dns/rdata/generic/detail/ds_like.h35
-rw-r--r--src/lib/dns/rdata/generic/dlv_32769.cc5
-rw-r--r--src/lib/dns/rdata/generic/ds_43.cc5
-rw-r--r--src/lib/dns/tests/rdata_ds_like_unittest.cc12
5 files changed, 58 insertions, 1 deletions
diff --git a/src/lib/dns/gen-rdatacode.py.in b/src/lib/dns/gen-rdatacode.py.in
index b385bf4192..db9a0df4bf 100755
--- a/src/lib/dns/gen-rdatacode.py.in
+++ b/src/lib/dns/gen-rdatacode.py.in
@@ -34,7 +34,9 @@ import sys
# new_rdata_factory_users = [('a', 'in'), ('a', 'ch'), ('soa', 'generic')]
new_rdata_factory_users = [('aaaa', 'in'),
('cname', 'generic'),
+ ('dlv', 'generic'),
('dname', 'generic'),
+ ('ds', 'generic'),
('hinfo', 'generic'),
('naptr', 'generic'),
('mx', 'generic'),
diff --git a/src/lib/dns/rdata/generic/detail/ds_like.h b/src/lib/dns/rdata/generic/detail/ds_like.h
index 333de4c010..a73ee29be8 100644
--- a/src/lib/dns/rdata/generic/detail/ds_like.h
+++ b/src/lib/dns/rdata/generic/detail/ds_like.h
@@ -101,6 +101,41 @@ public:
decodeHex(digestbuf.str(), digest_);
}
+ DSLikeImpl(MasterLexer& lexer, const Name*, MasterLoader::Options,
+ MasterLoaderCallbacks&)
+ {
+ const uint32_t tag =
+ lexer.getNextToken(MasterToken::NUMBER).getNumber();
+ if (tag > 0xffff) {
+ isc_throw(InvalidRdataText,
+ "Invalid " << RRType(typeCode) << " tag: " << tag);
+ }
+
+ const uint32_t algorithm =
+ lexer.getNextToken(MasterToken::NUMBER).getNumber();
+ if (algorithm > 0xff) {
+ isc_throw(InvalidRdataText,
+ "Invalid " << RRType(typeCode) << " algorithm: "
+ << algorithm);
+ }
+
+ const uint32_t digest_type =
+ lexer.getNextToken(MasterToken::NUMBER).getNumber();
+ if (digest_type > 0xff) {
+ isc_throw(InvalidRdataText,
+ "Invalid " << RRType(typeCode) << " digest type: "
+ << digest_type);
+ }
+
+ const std::string digest =
+ lexer.getNextToken(MasterToken::STRING).getString();
+
+ tag_ = tag;
+ algorithm_ = algorithm;
+ digest_type_ = digest_type;
+ decodeHex(digest, digest_);
+ }
+
/// \brief Constructor from wire-format data.
///
/// \param buffer A buffer storing the wire format data.
diff --git a/src/lib/dns/rdata/generic/dlv_32769.cc b/src/lib/dns/rdata/generic/dlv_32769.cc
index a3db998ebd..89a62e1b82 100644
--- a/src/lib/dns/rdata/generic/dlv_32769.cc
+++ b/src/lib/dns/rdata/generic/dlv_32769.cc
@@ -45,6 +45,11 @@ DLV::DLV(InputBuffer& buffer, size_t rdata_len) :
impl_(new DLVImpl(buffer, rdata_len))
{}
+DLV::DLV(MasterLexer& lexer, const Name* origin, MasterLoader::Options options,
+ MasterLoaderCallbacks& callbacks) :
+ impl_(new DLVImpl(lexer, origin, options, callbacks))
+{}
+
/// \brief Copy constructor
///
/// A copy of the implementation object is allocated and constructed.
diff --git a/src/lib/dns/rdata/generic/ds_43.cc b/src/lib/dns/rdata/generic/ds_43.cc
index 4234f9d575..349238870d 100644
--- a/src/lib/dns/rdata/generic/ds_43.cc
+++ b/src/lib/dns/rdata/generic/ds_43.cc
@@ -39,6 +39,11 @@ DS::DS(InputBuffer& buffer, size_t rdata_len) :
impl_(new DSImpl(buffer, rdata_len))
{}
+DS::DS(MasterLexer& lexer, const Name* origin, MasterLoader::Options options,
+ MasterLoaderCallbacks& callbacks) :
+ impl_(new DSImpl(lexer, origin, options, callbacks))
+{}
+
DS::DS(const DS& source) :
Rdata(), impl_(new DSImpl(*source.impl_))
{}
diff --git a/src/lib/dns/tests/rdata_ds_like_unittest.cc b/src/lib/dns/tests/rdata_ds_like_unittest.cc
index 28a2e174f8..d30c923f51 100644
--- a/src/lib/dns/tests/rdata_ds_like_unittest.cc
+++ b/src/lib/dns/tests/rdata_ds_like_unittest.cc
@@ -91,8 +91,18 @@ TYPED_TEST(Rdata_DS_LIKE_Test, createFromLexer_DS_LIKE) {
ds_like_txt)));
// Exceptions cause NULL to be returned.
+
+ // Bad tag
+ EXPECT_FALSE(test::createRdataUsingLexer(RRTYPE<TypeParam>(), RRClass::IN(),
+ "65536 5 2 BEEF"));
+
+ // Bad algorithm
+ EXPECT_FALSE(test::createRdataUsingLexer(RRTYPE<TypeParam>(), RRClass::IN(),
+ "1024 256 2 BEEF"));
+
+ // Bad digest type
EXPECT_FALSE(test::createRdataUsingLexer(RRTYPE<TypeParam>(), RRClass::IN(),
- "99999 5 2 BEEF"));
+ "2048 2 256 BEEF"));
}
TYPED_TEST(Rdata_DS_LIKE_Test, assignment_DS_LIKE) {