Commit 7ffef24a authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[1483] Protect the method by exception

parent b2da8d97
......@@ -410,6 +410,9 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
const isc::dns::RRType& type,
const FindOptions options)
{
if (type == RRType::ANY()) {
isc_throw(isc::Unexpected, "Use findAll to answer ANY");
}
return (findInternal(name, type, NULL, options));
}
......
......@@ -2287,6 +2287,12 @@ TYPED_TEST(DatabaseClientTest, emptyNonterminalNSEC) {
Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC));
}
TYPED_TEST(DatabaseClientTest, anyFromFind) {
// Find will reject answering an ANY query
EXPECT_THROW(this->getFinder()->find(isc::dns::Name("www2.example.org."),
RRType::ANY()), isc::Unexpected);
}
// Test the findAll method.
TYPED_TEST(DatabaseClientTest, getAll) {
// The domain doesn't exist, so we must get the right NSEC
......
Supports Markdown
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