assert(rdataset != NULL);
assert(rdataset->type == RRType::NSEC3());
+ // Check for the rare case of RRSIG-only record; in theory it could exist
+ // but we simply consider it broken for NSEC3.
+ if (rdataset->getRdataCount() == 0) {
+ uint8_t labels_buf[LabelSequence::MAX_SERIALIZED_LENGTH];
+ isc_throw(DataSourceError, "Broken zone: RRSIG-only NSEC3 record at "
+ << node->getAbsoluteLabels(labels_buf) << "/" << rrclass);
+ }
+
// Create the RRset. Note the DNSSEC flag: NSEC3 implies DNSSEC.
return (createTreeNodeRRset(node, rdataset, rrclass,
ZoneFinder::FIND_DNSSEC));
}
}
}
+
+TEST_F(InMemoryZoneFinderNSEC3Test, RRSIGOnly) {
+ // add an RRSIG-only NSEC3 to the NSEC3 space, and try to find it; it
+ // should result in an exception.
+ const string n8_hash = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";
+ updater_.add(ConstRRsetPtr(),
+ textToRRset(
+ n8_hash + ".example.org. 300 IN RRSIG NSEC3 5 3 300 "
+ "20120814220826 20120715220826 1234 example.com. FAKE"));
+ EXPECT_THROW(zone_finder_.findNSEC3(Name("n8.example.org"), false),
+ DataSourceError);
+}
+
}