Commit 061e18bd authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[trac646] fixed a bug that a failure in finding one glue led to dropping all glues.

parent 14d7b2bc
......@@ -1013,6 +1013,13 @@ DataSrc::doQuery(Query& q) {
continue;
} else if ((task->flags & (NAME_NOT_FOUND|TYPE_NOT_FOUND)) != 0) {
// No data found at this qname/qtype.
// If we were looking for additional data, we should simply
// ignore this result.
if (task->state == QueryTask::GETADDITIONAL) {
continue;
}
// If we were looking for answer data, not additional,
// and the name was not found, we need to find out whether
// there are any relevant wildcards.
......
......@@ -1035,6 +1035,25 @@ TEST_F(DataSrcTest, apexCNAMEZone) {
DataSourceError);
}
TEST_F(DataSrcTest, incompleteGlue) {
// One of the NS names belong to a different zone (which is still
// authoritative), and the glue is missing in that zone. We should
// still return the existent glue.
// (nons.example is also broken in that it doesn't have apex NS, but
// that doesn't matter for this test)
createAndProcessQuery(Name("www.incompletechild.nons.example"),
RRClass::IN(), RRType::A());
headerCheck(msg, qid, Rcode::NOERROR(), opcodeval,
QR_FLAG | RD_FLAG, 1, 0, 2, 1);
rrsetsCheck("incompletechild.nons.example. 3600 IN NS ns.incompletechild.nons.example.\n"
"incompletechild.nons.example. 3600 IN NS nx.nosoa.example.",
msg.beginSection(Message::SECTION_AUTHORITY),
msg.endSection(Message::SECTION_AUTHORITY));
rrsetsCheck("ns.incompletechild.nons.example. 3600 IN A 192.0.2.1",
msg.beginSection(Message::SECTION_ADDITIONAL),
msg.endSection(Message::SECTION_ADDITIONAL));
}
// currently fails
TEST_F(DataSrcTest, DISABLED_synthesizedCnameTooLong) {
// qname has the possible max length (255 octets). it matches a DNAME,
......
......@@ -199,6 +199,7 @@ const struct RRData example_com_records[] = {
{NULL, NULL, NULL}
};
const struct RRData example_com_glue_records[] = {
{"ns1.subzone.example.com", "A", "192.0.2.1"},
{"ns2.subzone.example.com", "A", "192.0.2.2"},
......@@ -247,6 +248,20 @@ const struct RRData nons_example_records[] = {
"1234 3600 1800 2419200 7200"},
{"www.nons.example", "A", "192.0.2.1"},
{"ns.nons.example", "A", "192.0.2.2"},
// One of the NS names is intentionally non existent in the zone it belongs
// to. This delegation is used to see if we still return the NS and the
// existent glue.
// (These are not relevant to test the case for the "no NS" case. We use
// this zone to minimize the number of test zones)
{"incompletechild.nons.example", "NS", "ns.incompletechild.nons.example"},
{"incompletechild.nons.example", "NS", "nx.nosoa.example"},
{NULL, NULL, NULL}
};
const struct RRData nons_example_glue_records[] = {
{"ns.incompletechild.nons.example", "A", "192.0.2.1"},
{NULL, NULL, NULL}
};
......@@ -298,7 +313,7 @@ const struct ZoneData zone_data[] = {
{ "example.com", "IN", example_com_records, example_com_glue_records },
{ "sql1.example.com", "IN", sql1_example_com_records, empty_records },
{ "loop.example", "IN", loop_example_records, empty_records },
{ "nons.example", "IN", nons_example_records, empty_records },
{ "nons.example", "IN", nons_example_records, nons_example_glue_records },
{ "nons-dname.example", "IN", nonsdname_example_records, empty_records },
{ "nosoa.example", "IN", nosoa_example_records, empty_records },
{ "apexcname.example", "IN", nosoa_example_records, empty_records }
......
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