Commit 150e7028 authored by Evan Hunt's avatar Evan Hunt
Browse files

- query for ./DS no longer tries to find the parent of .

- query for NSEC, DS, or DNAME at a zone cut now returns a referral
  if the parent doesn't have data of the requested type to return


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1433 e5f2f494-b856-4b98-b285-d166d9295462
parent 6fbf1972
......@@ -512,7 +512,8 @@ DataSrc::doQuery(Query& q)
// Find the closest enclosing zone for which we are authoritative,
// and the concrete data source which is authoritative for it.
// (Note that RRtype DS queries need to go to the parent.)
NameMatch match(task->qtype == RRType::DS() ?
int nlabels = task->qname.getLabelCount() - 1;
NameMatch match(nlabels != 0 && task->qtype == RRType::DS() ?
task->qname.split(1, task->qname.getLabelCount() - 1) :
task->qname);
findClosestEnclosure(match, task->qclass);
......@@ -543,12 +544,13 @@ DataSrc::doQuery(Query& q)
// Query found a referral; let's find out if that was expected--
// i.e., if an NS was at the zone apex, or if we were querying
// specifically for the DS, NSEC, or DNAME record.
// specifically for, and found, a DS, NSEC, or DNAME record.
if ((task->flags & REFERRAL) != 0 &&
(zonename->getLabelCount() == task->qname.getLabelCount() ||
task->qtype == RRType::DS() ||
task->qtype == RRType::NSEC() ||
task->qtype == RRType::DNAME())) {
((task->qtype == RRType::NSEC() ||
task->qtype == RRType::DS() ||
task->qtype == RRType::DNAME()) &&
data.findRRset(task->qtype, task->qclass)))) {
task->flags &= ~REFERRAL;
}
} else {
......
......@@ -74,7 +74,8 @@ const char* const SCHEMA_LIST[] = {
"CREATE INDEX records_byname ON records (name)",
"CREATE INDEX records_byrname ON records (rname)",
"CREATE TABLE nsec3 (id INTEGER PRIMARY KEY, zone_id INTEGER NOT NULL, "
"hash STRING NOT NULL COLLATE NOCASE, owner STRING NOT NULL COLLATE NOCASE, "
"hash STRING NOT NULL COLLATE NOCASE, "
"owner STRING NOT NULL COLLATE NOCASE, "
"ttl INTEGER NOT NULL, rdtype STRING NOT NULL COLLATE NOCASE, "
"rdata STRING NOT NULL)",
"CREATE INDEX nsec3_byhash ON nsec3 (hash)",
......@@ -82,27 +83,35 @@ const char* const SCHEMA_LIST[] = {
};
const char* const q_zone_str = "SELECT id FROM zones WHERE name=?1";
const char* const q_record_str = "SELECT rdtype, ttl, sigtype, rdata "
"FROM records WHERE zone_id=?1 AND name=?2 AND "
"((rdtype=?3 OR sigtype=?3) OR "
"(rdtype='CNAME' OR sigtype='CNAME') OR "
"(rdtype='NS' OR sigtype='NS'))";
const char* const q_addrs_str = "SELECT rdtype, ttl, sigtype, rdata "
"FROM records WHERE zone_id=?1 AND name=?2 AND "
"(rdtype='A' OR sigtype='A' OR rdtype='AAAA' OR sigtype='AAAA')";
const char* const q_referral_str = "SELECT rdtype, ttl, sigtype, rdata FROM "
"records WHERE zone_id=?1 AND name=?2 AND"
"(rdtype='NS' OR sigtype='NS' OR rdtype='DS' OR sigtype='DS' OR "
"rdtype='DNAME' OR sigtype='DNAME')";
const char* const q_any_str = "SELECT rdtype, ttl, sigtype, rdata "
"FROM records WHERE zone_id=?1 AND name=?2";
const char* const q_count_str = "SELECT COUNT(*) FROM records "
"WHERE zone_id=?1 AND rname LIKE (?2 || '%');";
const char* const q_previous_str = "SELECT name FROM records "
"WHERE zone_id=?1 AND rdtype = 'NSEC' AND "
"rname < $2 ORDER BY rname DESC LIMIT 1";
const char* const q_nsec3_str = "SELECT rdtype, ttl, rdata FROM nsec3 "
"WHERE zone_id = ?1 AND hash = $2";
const char* const q_prevnsec3_str = "SELECT hash FROM nsec3 "
"WHERE zone_id = ?1 AND hash <= $2 ORDER BY hash DESC LIMIT 1";
......
......@@ -716,11 +716,11 @@ TEST_F(DataSrcTest, NSECZonecutOfNonsecureZone) {
}
#endif
#if 0 // currently fails
//#if 0 // currently fails
TEST_F(DataSrcTest, RootDSQuery) {
createAndProcessQuery(Name("."), RRClass::IN(), RRType::DS());
}
#endif
//#endif
// Non-existent name in the "static" data source. The purpose of this test
// is to check a corner case behavior when atypical RRClass (CH in this case)
......
Markdown is supported
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