Commit 943f1cdb authored by Evan Hunt's avatar Evan Hunt
Browse files

- handle wildcard queries correctly when there is no data of the requested type

- handle wildcard queries correctly when there is a wildcard CNAME
- added a unit test for the nodata case (still need to do one for the CNAME)


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1317 e5f2f494-b856-4b98-b285-d166d9295462
parent e2757e28
......@@ -430,14 +430,19 @@ tryWildcard(Query& q, QueryTaskPtr task, const DataSrc* ds,
for (int i = 1; i <= diff; ++i) {
const Name& wname(star.concatenate(task->qname.split(i, nlen - i)));
QueryTask newtask(wname, task->qclass, task->qtype,
QueryTask::SIMPLE_QUERY);
QueryTask newtask(wname, task->qclass, task->qtype, Section::ANSWER(),
QueryTask::AUTH_QUERY);
result = doQueryTask(ds, zonename, newtask, wild);
if (result == DataSrc::SUCCESS &&
(newtask.flags == 0 || (newtask.flags & DataSrc::CNAME_FOUND))) {
rflags = newtask.flags;
found = true;
break;
if (result == DataSrc::SUCCESS) {
if (newtask.flags == 0 || (newtask.flags & DataSrc::CNAME_FOUND)) {
rflags = newtask.flags;
found = true;
break;
} else if ((newtask.flags & DataSrc::TYPE_NOT_FOUND) != 0) {
task->flags &= ~DataSrc::NAME_NOT_FOUND;
task->flags |= DataSrc::TYPE_NOT_FOUND;
break;
}
}
}
......
......@@ -252,6 +252,14 @@ TEST_F(DataSrcTest, Wildcard) {
EXPECT_TRUE(it->isLast());
}
TEST_F(DataSrcTest, WildcardNodata) {
// Check that a query for a data type not covered by the wildcard
// returns NOERROR
readAndProcessQuery(msg, "testdata/q_wild2");
headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 2, 0);
}
TEST_F(DataSrcTest, AuthDelegation) {
readAndProcessQuery(msg, "testdata/q_sql1");
......
# www.wild.example.com/A (wildcard)
d8 ef 01 00 00 01 00 00 00 00 00 00 03 77 77 77
04 77 69 6c 64 07 65 78 61 6d 70 6c 65 03 63 6f
6d 00 00 1c 00 01
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