|
@@ -217,6 +217,13 @@ public:
|
|
|
"t644ebqk9bibcna874givr6joj62mlhv";
|
|
|
hash_map_[Name("www1.uwild.example.com")] =
|
|
|
"q04jkcevqvmu85r014c7dkba38o0ji6r"; // a bit larger than H(www)
|
|
|
+
|
|
|
+ // For empty-non-terminal derived from insecure delegation (we don't
|
|
|
+ // need a hash for the delegation point itself for that test). the
|
|
|
+ // hash for empty name is the same as that for unsigned-delegation
|
|
|
+ // above, as the case is similar to that.
|
|
|
+ hash_map_[Name("empty.example.com")] =
|
|
|
+ "q81r598950igr1eqvc60aedlq66425b5"; // a bit larger than H(www)
|
|
|
}
|
|
|
virtual string calculate(const Name& name) const {
|
|
|
const NSEC3HashMap::const_iterator found = hash_map_.find(name);
|
|
@@ -262,8 +269,6 @@ public:
|
|
|
// to child zones are identified by the existence of non origin NS records.
|
|
|
// Another special name is "dname.example.com". Query names under this name
|
|
|
// will result in DNAME.
|
|
|
-// This mock zone doesn't handle empty non terminal nodes (if we need to test
|
|
|
-// such cases find() should have specialized code for it).
|
|
|
class MockZoneFinder : public ZoneFinder {
|
|
|
public:
|
|
|
MockZoneFinder() :
|
|
@@ -2468,21 +2473,32 @@ TEST_P(QueryTest, nxrrsetWithNSEC3) {
|
|
|
NULL, mock_finder->getOrigin());
|
|
|
}
|
|
|
|
|
|
-// Check the exception is correctly raised when the NSEC3 thing isn't in the
|
|
|
-// zone
|
|
|
-TEST_F(QueryTestForMockOnly, nxrrsetMissingNSEC3) {
|
|
|
- // This is a broken data source scenario; works only with mock.
|
|
|
-
|
|
|
- mock_finder->setNSEC3Flag(true);
|
|
|
- // We just need it to return false for "matched". This indicates
|
|
|
- // there's no exact match for NSEC3 on www.example.com.
|
|
|
- ZoneFinder::FindNSEC3Result nsec3(false, 0, ConstRRsetPtr(),
|
|
|
- ConstRRsetPtr());
|
|
|
- mock_finder->setNSEC3Result(&nsec3);
|
|
|
+TEST_P(QueryTest, nxrrsetDerivedFromOptOutNSEC3) {
|
|
|
+ // In this test we emulate the situation where an empty non-terminal name
|
|
|
+ // is derived from insecure delegation and covered by an opt-out NSEC3.
|
|
|
+ // In the actual test data the covering NSEC3 really has the opt-out
|
|
|
+ // bit set, although the implementation doesn't check it anyway.
|
|
|
+ enableNSEC3(rrsets_to_add_);
|
|
|
+ query.process(*list_, Name("empty.example.com"), RRType::TXT(), response,
|
|
|
+ true);
|
|
|
|
|
|
- EXPECT_THROW(query.process(*list_, Name("www.example.com"),
|
|
|
- RRType::TXT(), response, true),
|
|
|
- Query::BadNSEC3);
|
|
|
+ // The closest provable encloser is the origin name (example.com.), and
|
|
|
+ // the next closer is the empty name itself, which is expected to be
|
|
|
+ // covered by an opt-out NSEC3 RR. The response should contain these 2
|
|
|
+ // NSEC3s.
|
|
|
+ responseCheck(response, Rcode::NOERROR(), AA_FLAG, 0, 6, 0, NULL,
|
|
|
+ (string(soa_minttl_txt) +
|
|
|
+ string("example.com. 0 IN RRSIG ") +
|
|
|
+ getCommonRRSIGText("SOA") + "\n" +
|
|
|
+ string(nsec3_apex_txt) + "\n" +
|
|
|
+ nsec3_hash_.calculate(Name("example.com.")) +
|
|
|
+ ".example.com. 3600 IN RRSIG " +
|
|
|
+ getCommonRRSIGText("NSEC3") + "\n" +
|
|
|
+ string(nsec3_www_txt) + "\n" +
|
|
|
+ nsec3_hash_.calculate(Name("www.example.com.")) +
|
|
|
+ ".example.com. 3600 IN RRSIG " +
|
|
|
+ getCommonRRSIGText("NSEC3") + "\n").c_str(),
|
|
|
+ NULL, mock_finder->getOrigin());
|
|
|
}
|
|
|
|
|
|
TEST_P(QueryTest, nxrrsetWithNSEC3_ds_exact) {
|