Commit 48896de1 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

merged branches/trac249: throw an exception if the apex SOA/NS is missing.

also refactored datasrc test mock.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2286 e5f2f494-b856-4b98-b285-d166d9295462
parent afff755e
......@@ -613,9 +613,12 @@ DataSrc::doQuery(Query& q) {
// the authority section.
RRsetList auth;
if (!refQuery(*zonename, q.qclass(), datasource, zonename,
auth)) {
m.setRcode(Rcode::SERVFAIL());
return;
auth) ||
!auth.findRRset(RRType::NS(),
datasource->getClass())) {
isc_throw(DataSourceError,
"NS RR not found in " << *zonename << "/" <<
datasource->getClass());
}
copyAuth(q, auth);
......@@ -704,8 +707,9 @@ DataSrc::doQuery(Query& q) {
result = addSOA(q, zonename, datasource);
if (result != SUCCESS) {
m.setRcode(Rcode::SERVFAIL());
return;
isc_throw(DataSourceError,
"SOA RR not found in" << *zonename <<
"/" << datasource->getClass());
}
}
......
......@@ -770,7 +770,7 @@ TEST_F(DataSrcTest, DS) {
}
TEST_F(DataSrcTest, CNAMELoop) {
createAndProcessQuery(Name("loop1.example.com"), RRClass::IN(),
createAndProcessQuery(Name("one.loop.example"), RRClass::IN(),
RRType::A());
}
......@@ -864,4 +864,22 @@ TEST_F(DataSrcTest, DISABLED_synthesizedCnameTooLong) {
RRClass::IN(), RRType::A());
}
TEST_F(DataSrcTest, noNSZone) {
EXPECT_THROW(createAndProcessQuery(Name("www.nons.example"),
RRClass::IN(), RRType::A()),
DataSourceError);
}
TEST_F(DataSrcTest, noNSButDnameZone) {
EXPECT_THROW(createAndProcessQuery(Name("www.nons-dname.example"),
RRClass::IN(), RRType::A()),
DataSourceError);
}
TEST_F(DataSrcTest, noSOAZone) {
EXPECT_THROW(createAndProcessQuery(Name("notexist.nosoa.example"),
RRClass::IN(), RRType::A()),
DataSourceError);
}
}
This diff is collapsed.
......@@ -96,6 +96,7 @@ private:
ADDRESS,
DELEGATION
};
class RRsetMatch;
void findRecords(const isc::dns::Name& name, const isc::dns::RRType& rdtype,
isc::dns::RRsetList& target,
......
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