From: JINMEI Tatuya Date: Mon, 30 Jan 2012 22:17:54 +0000 (-0800) Subject: [1574b] check multiple NSEC3PARAMs (not supported in this implementation) X-Git-Tag: trac2351_base~268^2~5^2~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37c1b4a1d2fb5cfd630d43b016e514ce2d58fa59;p=thirdparty%2Fkea.git [1574b] check multiple NSEC3PARAMs (not supported in this implementation) --- diff --git a/src/lib/datasrc/memory_datasrc.cc b/src/lib/datasrc/memory_datasrc.cc index 9729e8be6a..2ace69c3bd 100644 --- a/src/lib/datasrc/memory_datasrc.cc +++ b/src/lib/datasrc/memory_datasrc.cc @@ -230,6 +230,13 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl { isc_throw(AddError, "multiple RRs of singleton type for " << rrset->getName()); } + // NSEC3PARAM is not a "singleton" per protocol, but this + // implementation doesn't request it be so at the moment. + if (rrset->getType() == RRType::NSEC3PARAM() && + rrset->getRdataCount() > 1) { + isc_throw(AddError, "Multiple NSEC3PARAM RDATA is given for " + << rrset->getName() << " which isn't supported"); + } NameComparisonResult compare(origin_.compare(rrset->getName())); if (compare.getRelation() != NameComparisonResult::SUPERDOMAIN && diff --git a/src/lib/datasrc/tests/memory_datasrc_unittest.cc b/src/lib/datasrc/tests/memory_datasrc_unittest.cc index 81fbce7262..f9177998bb 100644 --- a/src/lib/datasrc/tests/memory_datasrc_unittest.cc +++ b/src/lib/datasrc/tests/memory_datasrc_unittest.cc @@ -1478,6 +1478,15 @@ TEST_F(InMemoryZoneFinderTest, badRRsigForNSEC3) { InMemoryZoneFinder::AddError); } +TEST_F(InMemoryZoneFinderTest, multiNSEC3PARAM) { + // In this current implementation multiple NSEC3PARAM isn't supported. + RRsetPtr nsec3param(new RRset(Name("example.org"), RRClass::IN(), + RRType::NSEC3PARAM(), RRTTL(300))); + nsec3param->addRdata(generic::NSEC3PARAM("1 0 12 aabbccdd")); + nsec3param->addRdata(generic::NSEC3PARAM("1 1 1 ddccbbaa")); + EXPECT_THROW(zone_finder_.add(nsec3param), InMemoryZoneFinder::AddError); +} + // TODO // - parameter consistency // - existence of NSEC3PARAM