mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 22:15:23 +00:00
[1438] Strip the datasources of target parameter
Is is being deprecated by a separate method in this branch, so get rid of it.
This commit is contained in:
@@ -393,7 +393,6 @@ DatabaseClient::Finder::findNSECCover(const Name& name) {
|
|||||||
ZoneFinder::FindResult
|
ZoneFinder::FindResult
|
||||||
DatabaseClient::Finder::find(const isc::dns::Name& name,
|
DatabaseClient::Finder::find(const isc::dns::Name& name,
|
||||||
const isc::dns::RRType& type,
|
const isc::dns::RRType& type,
|
||||||
isc::dns::RRsetList*,
|
|
||||||
const FindOptions options)
|
const FindOptions options)
|
||||||
{
|
{
|
||||||
// This variable is used to determine the difference between
|
// This variable is used to determine the difference between
|
||||||
@@ -729,7 +728,7 @@ public:
|
|||||||
// Find the SOA of the zone (may or may not succeed). Note that
|
// Find the SOA of the zone (may or may not succeed). Note that
|
||||||
// this must be done before starting the iteration context.
|
// this must be done before starting the iteration context.
|
||||||
soa_ = DatabaseClient::Finder(accessor_, zone.second, zone_name).
|
soa_ = DatabaseClient::Finder(accessor_, zone.second, zone_name).
|
||||||
find(zone_name, RRType::SOA(), NULL).rrset;
|
find(zone_name, RRType::SOA()).rrset;
|
||||||
|
|
||||||
// Request the context
|
// Request the context
|
||||||
context_ = accessor_->getAllRecords(zone.second);
|
context_ = accessor_->getAllRecords(zone.second);
|
||||||
|
@@ -753,10 +753,6 @@ public:
|
|||||||
* (this implementation is not complete, and currently only
|
* (this implementation is not complete, and currently only
|
||||||
* does full matches, CNAMES, and the signatures for matches and
|
* does full matches, CNAMES, and the signatures for matches and
|
||||||
* CNAMEs)
|
* CNAMEs)
|
||||||
* \note target was used in the original design to handle ANY
|
|
||||||
* queries. This is not implemented yet, and may use
|
|
||||||
* target again for that, but it might also use something
|
|
||||||
* different. It is left in for compatibility at the moment.
|
|
||||||
* \note options are ignored at this moment
|
* \note options are ignored at this moment
|
||||||
*
|
*
|
||||||
* \note Maybe counter intuitively, this method is not a const member
|
* \note Maybe counter intuitively, this method is not a const member
|
||||||
@@ -780,13 +776,11 @@ public:
|
|||||||
*
|
*
|
||||||
* \param name The name to find
|
* \param name The name to find
|
||||||
* \param type The RRType to find
|
* \param type The RRType to find
|
||||||
* \param target Unused at this moment
|
|
||||||
* \param options Options about how to search.
|
* \param options Options about how to search.
|
||||||
* See ZoneFinder::FindOptions.
|
* See ZoneFinder::FindOptions.
|
||||||
*/
|
*/
|
||||||
virtual FindResult find(const isc::dns::Name& name,
|
virtual FindResult find(const isc::dns::Name& name,
|
||||||
const isc::dns::RRType& type,
|
const isc::dns::RRType& type,
|
||||||
isc::dns::RRsetList* target = NULL,
|
|
||||||
const FindOptions options = FIND_DEFAULT);
|
const FindOptions options = FIND_DEFAULT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -421,8 +421,8 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Implementation of InMemoryZoneFinder::find
|
// Implementation of InMemoryZoneFinder::find
|
||||||
FindResult find(const Name& name, RRType type,
|
FindResult find(const Name& name, RRType type, const FindOptions options)
|
||||||
RRsetList* target, const FindOptions options) const
|
const
|
||||||
{
|
{
|
||||||
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_FIND).arg(name).
|
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_FIND).arg(name).
|
||||||
arg(type);
|
arg(type);
|
||||||
@@ -566,6 +566,8 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
TODO: Move this to some other place, new method
|
||||||
// handle type any query
|
// handle type any query
|
||||||
if (target != NULL && !node->getData()->empty()) {
|
if (target != NULL && !node->getData()->empty()) {
|
||||||
// Empty domain will be handled as NXRRSET by normal processing
|
// Empty domain will be handled as NXRRSET by normal processing
|
||||||
@@ -580,6 +582,7 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
|
|||||||
arg(name);
|
arg(name);
|
||||||
return (FindResult(SUCCESS, ConstRRsetPtr()));
|
return (FindResult(SUCCESS, ConstRRsetPtr()));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
found = node->getData()->find(type);
|
found = node->getData()->find(type);
|
||||||
if (found != node->getData()->end()) {
|
if (found != node->getData()->end()) {
|
||||||
@@ -629,9 +632,9 @@ InMemoryZoneFinder::getClass() const {
|
|||||||
|
|
||||||
ZoneFinder::FindResult
|
ZoneFinder::FindResult
|
||||||
InMemoryZoneFinder::find(const Name& name, const RRType& type,
|
InMemoryZoneFinder::find(const Name& name, const RRType& type,
|
||||||
RRsetList* target, const FindOptions options)
|
const FindOptions options)
|
||||||
{
|
{
|
||||||
return (impl_->find(name, type, target, options));
|
return (impl_->find(name, type, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
result::Result
|
result::Result
|
||||||
|
@@ -74,7 +74,6 @@ public:
|
|||||||
/// (the base class documentation does not seem to require that).
|
/// (the base class documentation does not seem to require that).
|
||||||
virtual FindResult find(const isc::dns::Name& name,
|
virtual FindResult find(const isc::dns::Name& name,
|
||||||
const isc::dns::RRType& type,
|
const isc::dns::RRType& type,
|
||||||
isc::dns::RRsetList* target = NULL,
|
|
||||||
const FindOptions options = FIND_DEFAULT);
|
const FindOptions options = FIND_DEFAULT);
|
||||||
|
|
||||||
/// \brief Imelementation of the ZoneFinder::findPreviousName method
|
/// \brief Imelementation of the ZoneFinder::findPreviousName method
|
||||||
|
@@ -1419,8 +1419,7 @@ doFindTest(ZoneFinder& finder,
|
|||||||
const ZoneFinder::FindOptions options = ZoneFinder::FIND_DEFAULT)
|
const ZoneFinder::FindOptions options = ZoneFinder::FIND_DEFAULT)
|
||||||
{
|
{
|
||||||
SCOPED_TRACE("doFindTest " + name.toText() + " " + type.toText());
|
SCOPED_TRACE("doFindTest " + name.toText() + " " + type.toText());
|
||||||
const ZoneFinder::FindResult result = finder.find(name, type, NULL,
|
const ZoneFinder::FindResult result = finder.find(name, type, options);
|
||||||
options);
|
|
||||||
ASSERT_EQ(expected_result, result.code) << name << " " << type;
|
ASSERT_EQ(expected_result, result.code) << name << " " << type;
|
||||||
if (!expected_rdatas.empty() && result.rrset) {
|
if (!expected_rdatas.empty() && result.rrset) {
|
||||||
checkRRset(result.rrset, expected_name != Name(".") ? expected_name :
|
checkRRset(result.rrset, expected_name != Name(".") ? expected_name :
|
||||||
@@ -1670,58 +1669,58 @@ TYPED_TEST(DatabaseClientTest, find) {
|
|||||||
|
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("badcname1.example.org."),
|
EXPECT_THROW(finder->find(isc::dns::Name("badcname1.example.org."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("badcname2.example.org."),
|
EXPECT_THROW(finder->find(isc::dns::Name("badcname2.example.org."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("badcname3.example.org."),
|
EXPECT_THROW(finder->find(isc::dns::Name("badcname3.example.org."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("badrdata.example.org."),
|
EXPECT_THROW(finder->find(isc::dns::Name("badrdata.example.org."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("badtype.example.org."),
|
EXPECT_THROW(finder->find(isc::dns::Name("badtype.example.org."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("badttl.example.org."),
|
EXPECT_THROW(finder->find(isc::dns::Name("badttl.example.org."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("badsig.example.org."),
|
EXPECT_THROW(finder->find(isc::dns::Name("badsig.example.org."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
|
|
||||||
// Trigger the hardcoded exceptions and see if find() has cleaned up
|
// Trigger the hardcoded exceptions and see if find() has cleaned up
|
||||||
if (this->is_mock_) {
|
if (this->is_mock_) {
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("dsexception.in.search."),
|
EXPECT_THROW(finder->find(isc::dns::Name("dsexception.in.search."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("iscexception.in.search."),
|
EXPECT_THROW(finder->find(isc::dns::Name("iscexception.in.search."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
isc::Exception);
|
isc::Exception);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("basicexception.in.search."),
|
EXPECT_THROW(finder->find(isc::dns::Name("basicexception.in.search."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
std::exception);
|
std::exception);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("dsexception.in.getnext."),
|
EXPECT_THROW(finder->find(isc::dns::Name("dsexception.in.getnext."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("iscexception.in.getnext."),
|
EXPECT_THROW(finder->find(isc::dns::Name("iscexception.in.getnext."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
isc::Exception);
|
isc::Exception);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("basicexception.in.getnext."),
|
EXPECT_THROW(finder->find(isc::dns::Name("basicexception.in.getnext."),
|
||||||
this->qtype_,
|
this->qtype_,
|
||||||
NULL, ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
std::exception);
|
std::exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1840,17 +1839,17 @@ TYPED_TEST(DatabaseClientTest, findDelegation) {
|
|||||||
|
|
||||||
// This is broken dname, it contains two targets
|
// This is broken dname, it contains two targets
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("below.baddname.example.org."),
|
EXPECT_THROW(finder->find(isc::dns::Name("below.baddname.example.org."),
|
||||||
this->qtype_, NULL,
|
this->qtype_,
|
||||||
ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
|
|
||||||
// Broken NS - it lives together with something else
|
// Broken NS - it lives together with something else
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("brokenns1.example.org."),
|
EXPECT_THROW(finder->find(isc::dns::Name("brokenns1.example.org."),
|
||||||
this->qtype_, NULL,
|
this->qtype_,
|
||||||
ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
EXPECT_THROW(finder->find(isc::dns::Name("brokenns2.example.org."),
|
EXPECT_THROW(finder->find(isc::dns::Name("brokenns2.example.org."),
|
||||||
this->qtype_, NULL,
|
this->qtype_,
|
||||||
ZoneFinder::FIND_DEFAULT),
|
ZoneFinder::FIND_DEFAULT),
|
||||||
DataSourceError);
|
DataSourceError);
|
||||||
}
|
}
|
||||||
|
@@ -389,7 +389,6 @@ public:
|
|||||||
ZoneFinder::Result result,
|
ZoneFinder::Result result,
|
||||||
bool check_answer = true,
|
bool check_answer = true,
|
||||||
const ConstRRsetPtr& answer = ConstRRsetPtr(),
|
const ConstRRsetPtr& answer = ConstRRsetPtr(),
|
||||||
RRsetList* target = NULL,
|
|
||||||
InMemoryZoneFinder* zone_finder = NULL,
|
InMemoryZoneFinder* zone_finder = NULL,
|
||||||
ZoneFinder::FindOptions options = ZoneFinder::FIND_DEFAULT,
|
ZoneFinder::FindOptions options = ZoneFinder::FIND_DEFAULT,
|
||||||
bool check_wild_answer = false)
|
bool check_wild_answer = false)
|
||||||
@@ -402,7 +401,7 @@ public:
|
|||||||
EXPECT_NO_THROW({
|
EXPECT_NO_THROW({
|
||||||
ZoneFinder::FindResult find_result(zone_finder->find(
|
ZoneFinder::FindResult find_result(zone_finder->find(
|
||||||
name, rrtype,
|
name, rrtype,
|
||||||
target, options));
|
options));
|
||||||
// Check it returns correct answers
|
// Check it returns correct answers
|
||||||
EXPECT_EQ(result, find_result.code);
|
EXPECT_EQ(result, find_result.code);
|
||||||
if (check_answer) {
|
if (check_answer) {
|
||||||
@@ -522,7 +521,7 @@ TEST_F(InMemoryZoneFinderTest, findCNAMEUnderZoneCut) {
|
|||||||
RRTTL(300)));
|
RRTTL(300)));
|
||||||
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_cname_under_cut_));
|
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_cname_under_cut_));
|
||||||
findTest(Name("cname.child.example.org"), RRType::AAAA(),
|
findTest(Name("cname.child.example.org"), RRType::AAAA(),
|
||||||
ZoneFinder::CNAME, true, rr_cname_under_cut_, NULL, NULL,
|
ZoneFinder::CNAME, true, rr_cname_under_cut_, NULL,
|
||||||
ZoneFinder::FIND_GLUE_OK);
|
ZoneFinder::FIND_GLUE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,7 +597,7 @@ TEST_F(InMemoryZoneFinderTest, DNAMEUnderNS) {
|
|||||||
|
|
||||||
findTest(lowName, RRType::A(), ZoneFinder::DELEGATION, true, rr_child_ns_);
|
findTest(lowName, RRType::A(), ZoneFinder::DELEGATION, true, rr_child_ns_);
|
||||||
findTest(lowName, RRType::A(), ZoneFinder::DNAME, true, rr_child_dname_,
|
findTest(lowName, RRType::A(), ZoneFinder::DNAME, true, rr_child_dname_,
|
||||||
NULL, NULL, ZoneFinder::FIND_GLUE_OK);
|
NULL, ZoneFinder::FIND_GLUE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test adding child zones and zone cut handling
|
// Test adding child zones and zone cut handling
|
||||||
@@ -630,6 +629,8 @@ TEST_F(InMemoryZoneFinderTest, delegationNS) {
|
|||||||
ZoneFinder::DELEGATION, true, rr_child_ns_);
|
ZoneFinder::DELEGATION, true, rr_child_ns_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
TODO: Update to the new interface
|
||||||
TEST_F(InMemoryZoneFinderTest, findAny) {
|
TEST_F(InMemoryZoneFinderTest, findAny) {
|
||||||
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_a_)));
|
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_a_)));
|
||||||
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_)));
|
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_)));
|
||||||
@@ -638,7 +639,7 @@ TEST_F(InMemoryZoneFinderTest, findAny) {
|
|||||||
// origin
|
// origin
|
||||||
RRsetList origin_rrsets;
|
RRsetList origin_rrsets;
|
||||||
findTest(origin_, RRType::ANY(), ZoneFinder::SUCCESS, true,
|
findTest(origin_, RRType::ANY(), ZoneFinder::SUCCESS, true,
|
||||||
ConstRRsetPtr(), &origin_rrsets);
|
ConstRRsetPtr(), NULL, &origin_rrsets);
|
||||||
EXPECT_EQ(2, origin_rrsets.size());
|
EXPECT_EQ(2, origin_rrsets.size());
|
||||||
EXPECT_EQ(rr_a_, origin_rrsets.findRRset(RRType::A(), RRClass::IN()));
|
EXPECT_EQ(rr_a_, origin_rrsets.findRRset(RRType::A(), RRClass::IN()));
|
||||||
EXPECT_EQ(rr_ns_, origin_rrsets.findRRset(RRType::NS(), RRClass::IN()));
|
EXPECT_EQ(rr_ns_, origin_rrsets.findRRset(RRType::NS(), RRClass::IN()));
|
||||||
@@ -646,12 +647,12 @@ TEST_F(InMemoryZoneFinderTest, findAny) {
|
|||||||
// out zone name
|
// out zone name
|
||||||
RRsetList out_rrsets;
|
RRsetList out_rrsets;
|
||||||
findTest(Name("example.com"), RRType::ANY(), ZoneFinder::NXDOMAIN, true,
|
findTest(Name("example.com"), RRType::ANY(), ZoneFinder::NXDOMAIN, true,
|
||||||
ConstRRsetPtr(), &out_rrsets);
|
ConstRRsetPtr(), NULL, &out_rrsets);
|
||||||
EXPECT_EQ(0, out_rrsets.size());
|
EXPECT_EQ(0, out_rrsets.size());
|
||||||
|
|
||||||
RRsetList glue_child_rrsets;
|
RRsetList glue_child_rrsets;
|
||||||
findTest(rr_child_glue_->getName(), RRType::ANY(), ZoneFinder::SUCCESS,
|
findTest(rr_child_glue_->getName(), RRType::ANY(), ZoneFinder::SUCCESS,
|
||||||
true, ConstRRsetPtr(), &glue_child_rrsets);
|
true, ConstRRsetPtr(), NULL, &glue_child_rrsets);
|
||||||
EXPECT_EQ(rr_child_glue_, glue_child_rrsets.findRRset(RRType::A(),
|
EXPECT_EQ(rr_child_glue_, glue_child_rrsets.findRRset(RRType::A(),
|
||||||
RRClass::IN()));
|
RRClass::IN()));
|
||||||
EXPECT_EQ(1, glue_child_rrsets.size());
|
EXPECT_EQ(1, glue_child_rrsets.size());
|
||||||
@@ -674,6 +675,7 @@ TEST_F(InMemoryZoneFinderTest, findAny) {
|
|||||||
true, rr_child_ns_, &new_glue_child_rrsets);
|
true, rr_child_ns_, &new_glue_child_rrsets);
|
||||||
EXPECT_EQ(0, new_glue_child_rrsets.size());
|
EXPECT_EQ(0, new_glue_child_rrsets.size());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_F(InMemoryZoneFinderTest, glue) {
|
TEST_F(InMemoryZoneFinderTest, glue) {
|
||||||
// install zone data:
|
// install zone data:
|
||||||
@@ -693,26 +695,26 @@ TEST_F(InMemoryZoneFinderTest, glue) {
|
|||||||
|
|
||||||
// If we do it in the "glue OK" mode, we should find the exact match.
|
// If we do it in the "glue OK" mode, we should find the exact match.
|
||||||
findTest(rr_child_glue_->getName(), RRType::A(), ZoneFinder::SUCCESS, true,
|
findTest(rr_child_glue_->getName(), RRType::A(), ZoneFinder::SUCCESS, true,
|
||||||
rr_child_glue_, NULL, NULL, ZoneFinder::FIND_GLUE_OK);
|
rr_child_glue_, NULL, ZoneFinder::FIND_GLUE_OK);
|
||||||
|
|
||||||
// glue OK + NXRRSET case
|
// glue OK + NXRRSET case
|
||||||
findTest(rr_child_glue_->getName(), RRType::AAAA(), ZoneFinder::NXRRSET,
|
findTest(rr_child_glue_->getName(), RRType::AAAA(), ZoneFinder::NXRRSET,
|
||||||
true, ConstRRsetPtr(), NULL, NULL, ZoneFinder::FIND_GLUE_OK);
|
true, ConstRRsetPtr(), NULL, ZoneFinder::FIND_GLUE_OK);
|
||||||
|
|
||||||
// glue OK + NXDOMAIN case
|
// glue OK + NXDOMAIN case
|
||||||
findTest(Name("www.child.example.org"), RRType::A(),
|
findTest(Name("www.child.example.org"), RRType::A(),
|
||||||
ZoneFinder::DELEGATION, true, rr_child_ns_, NULL, NULL,
|
ZoneFinder::DELEGATION, true, rr_child_ns_, NULL,
|
||||||
ZoneFinder::FIND_GLUE_OK);
|
ZoneFinder::FIND_GLUE_OK);
|
||||||
|
|
||||||
// nested cut case. The glue should be found.
|
// nested cut case. The glue should be found.
|
||||||
findTest(rr_grandchild_glue_->getName(), RRType::AAAA(),
|
findTest(rr_grandchild_glue_->getName(), RRType::AAAA(),
|
||||||
ZoneFinder::SUCCESS,
|
ZoneFinder::SUCCESS,
|
||||||
true, rr_grandchild_glue_, NULL, NULL, ZoneFinder::FIND_GLUE_OK);
|
true, rr_grandchild_glue_, NULL, ZoneFinder::FIND_GLUE_OK);
|
||||||
|
|
||||||
// A non-existent name in nested cut. This should result in delegation
|
// A non-existent name in nested cut. This should result in delegation
|
||||||
// at the highest zone cut.
|
// at the highest zone cut.
|
||||||
findTest(Name("www.grand.child.example.org"), RRType::TXT(),
|
findTest(Name("www.grand.child.example.org"), RRType::TXT(),
|
||||||
ZoneFinder::DELEGATION, true, rr_child_ns_, NULL, NULL,
|
ZoneFinder::DELEGATION, true, rr_child_ns_, NULL,
|
||||||
ZoneFinder::FIND_GLUE_OK);
|
ZoneFinder::FIND_GLUE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,14 +803,14 @@ TEST_F(InMemoryZoneFinderTest, load) {
|
|||||||
|
|
||||||
// Now see there are some rrsets (we don't look inside, though)
|
// Now see there are some rrsets (we don't look inside, though)
|
||||||
findTest(Name("."), RRType::SOA(), ZoneFinder::SUCCESS, false,
|
findTest(Name("."), RRType::SOA(), ZoneFinder::SUCCESS, false,
|
||||||
ConstRRsetPtr(), NULL, &rootzone);
|
ConstRRsetPtr(), &rootzone);
|
||||||
findTest(Name("."), RRType::NS(), ZoneFinder::SUCCESS, false,
|
findTest(Name("."), RRType::NS(), ZoneFinder::SUCCESS, false,
|
||||||
ConstRRsetPtr(), NULL, &rootzone);
|
ConstRRsetPtr(), &rootzone);
|
||||||
findTest(Name("a.root-servers.net."), RRType::A(), ZoneFinder::SUCCESS,
|
findTest(Name("a.root-servers.net."), RRType::A(), ZoneFinder::SUCCESS,
|
||||||
false, ConstRRsetPtr(), NULL, &rootzone);
|
false, ConstRRsetPtr(), &rootzone);
|
||||||
// But this should no longer be here
|
// But this should no longer be here
|
||||||
findTest(rr_ns_a_->getName(), RRType::AAAA(), ZoneFinder::NXDOMAIN, true,
|
findTest(rr_ns_a_->getName(), RRType::AAAA(), ZoneFinder::NXDOMAIN, true,
|
||||||
ConstRRsetPtr(), NULL, &rootzone);
|
ConstRRsetPtr(), &rootzone);
|
||||||
|
|
||||||
// Try loading zone that is wrong in a different way
|
// Try loading zone that is wrong in a different way
|
||||||
EXPECT_THROW(zone_finder_.load(TEST_DATA_DIR "/duplicate_rrset.zone"),
|
EXPECT_THROW(zone_finder_.load(TEST_DATA_DIR "/duplicate_rrset.zone"),
|
||||||
@@ -846,14 +848,14 @@ TEST_F(InMemoryZoneFinderTest, wildcard) {
|
|||||||
{
|
{
|
||||||
SCOPED_TRACE("Search at created child");
|
SCOPED_TRACE("Search at created child");
|
||||||
findTest(Name("a.wild.example.org"), RRType::A(), ZoneFinder::SUCCESS,
|
findTest(Name("a.wild.example.org"), RRType::A(), ZoneFinder::SUCCESS,
|
||||||
false, rr_wild_, NULL, NULL, ZoneFinder::FIND_DEFAULT, true);
|
false, rr_wild_, NULL, ZoneFinder::FIND_DEFAULT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search another created name, this time little bit lower
|
// Search another created name, this time little bit lower
|
||||||
{
|
{
|
||||||
SCOPED_TRACE("Search at created grand-child");
|
SCOPED_TRACE("Search at created grand-child");
|
||||||
findTest(Name("a.b.wild.example.org"), RRType::A(),
|
findTest(Name("a.b.wild.example.org"), RRType::A(),
|
||||||
ZoneFinder::SUCCESS, false, rr_wild_, NULL, NULL,
|
ZoneFinder::SUCCESS, false, rr_wild_, NULL,
|
||||||
ZoneFinder::FIND_DEFAULT, true);
|
ZoneFinder::FIND_DEFAULT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -885,11 +887,13 @@ TEST_F(InMemoryZoneFinderTest, delegatedWildcard) {
|
|||||||
{
|
{
|
||||||
SCOPED_TRACE("Looking under delegation point in GLUE_OK mode");
|
SCOPED_TRACE("Looking under delegation point in GLUE_OK mode");
|
||||||
findTest(Name("a.child.example.org"), RRType::A(),
|
findTest(Name("a.child.example.org"), RRType::A(),
|
||||||
ZoneFinder::DELEGATION, true, rr_child_ns_, NULL, NULL,
|
ZoneFinder::DELEGATION, true, rr_child_ns_, NULL,
|
||||||
ZoneFinder::FIND_GLUE_OK);
|
ZoneFinder::FIND_GLUE_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
When the new interface is created, use it
|
||||||
// Tests combination of wildcard and ANY.
|
// Tests combination of wildcard and ANY.
|
||||||
TEST_F(InMemoryZoneFinderTest, anyWildcard) {
|
TEST_F(InMemoryZoneFinderTest, anyWildcard) {
|
||||||
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_wild_));
|
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_wild_));
|
||||||
@@ -916,6 +920,7 @@ TEST_F(InMemoryZoneFinderTest, anyWildcard) {
|
|||||||
EXPECT_EQ(Name("a.wild.example.org"), (*target.begin())->getName());
|
EXPECT_EQ(Name("a.wild.example.org"), (*target.begin())->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Test there's nothing in the wildcard in the middle if we load
|
// Test there's nothing in the wildcard in the middle if we load
|
||||||
// wild.*.foo.example.org.
|
// wild.*.foo.example.org.
|
||||||
@@ -941,6 +946,8 @@ TEST_F(InMemoryZoneFinderTest, emptyWildcard) {
|
|||||||
findTest(Name("foo.example.org"), RRType::A(), ZoneFinder::NXRRSET);
|
findTest(Name("foo.example.org"), RRType::A(), ZoneFinder::NXRRSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
TODO: Update to the new interface
|
||||||
{
|
{
|
||||||
SCOPED_TRACE("Asking for ANY record");
|
SCOPED_TRACE("Asking for ANY record");
|
||||||
RRsetList normalTarget;
|
RRsetList normalTarget;
|
||||||
@@ -953,6 +960,7 @@ TEST_F(InMemoryZoneFinderTest, emptyWildcard) {
|
|||||||
ZoneFinder::NXRRSET, true, ConstRRsetPtr(), &wildTarget);
|
ZoneFinder::NXRRSET, true, ConstRRsetPtr(), &wildTarget);
|
||||||
EXPECT_EQ(0, wildTarget.size());
|
EXPECT_EQ(0, wildTarget.size());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
SCOPED_TRACE("Asking on the non-terminal");
|
SCOPED_TRACE("Asking on the non-terminal");
|
||||||
@@ -1005,6 +1013,8 @@ TEST_F(InMemoryZoneFinderTest, nestedEmptyWildcard) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
TODO: Update to the new interface once it is created
|
||||||
{
|
{
|
||||||
SCOPED_TRACE("Asking for ANY on parent nodes");
|
SCOPED_TRACE("Asking for ANY on parent nodes");
|
||||||
|
|
||||||
@@ -1017,6 +1027,7 @@ TEST_F(InMemoryZoneFinderTest, nestedEmptyWildcard) {
|
|||||||
EXPECT_EQ(0, target.size());
|
EXPECT_EQ(0, target.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// We run this part twice from the below test, in two slightly different
|
// We run this part twice from the below test, in two slightly different
|
||||||
@@ -1054,7 +1065,7 @@ InMemoryZoneFinderTest::doCancelWildcardTest() {
|
|||||||
SCOPED_TRACE(string("Node ") + *name);
|
SCOPED_TRACE(string("Node ") + *name);
|
||||||
|
|
||||||
findTest(Name(*name), RRType::A(), ZoneFinder::SUCCESS, false,
|
findTest(Name(*name), RRType::A(), ZoneFinder::SUCCESS, false,
|
||||||
rr_wild_, NULL, NULL, ZoneFinder::FIND_DEFAULT, true);
|
rr_wild_, NULL, ZoneFinder::FIND_DEFAULT, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1125,13 +1136,13 @@ TEST_F(InMemoryZoneFinderTest, swap) {
|
|||||||
EXPECT_EQ(RRClass::IN(), finder2.getClass());
|
EXPECT_EQ(RRClass::IN(), finder2.getClass());
|
||||||
// make sure the zone data is swapped, too
|
// make sure the zone data is swapped, too
|
||||||
findTest(origin_, RRType::NS(), ZoneFinder::NXDOMAIN, false,
|
findTest(origin_, RRType::NS(), ZoneFinder::NXDOMAIN, false,
|
||||||
ConstRRsetPtr(), NULL, &finder1);
|
ConstRRsetPtr(), &finder1);
|
||||||
findTest(other_origin, RRType::TXT(), ZoneFinder::SUCCESS, false,
|
findTest(other_origin, RRType::TXT(), ZoneFinder::SUCCESS, false,
|
||||||
ConstRRsetPtr(), NULL, &finder1);
|
ConstRRsetPtr(), &finder1);
|
||||||
findTest(origin_, RRType::NS(), ZoneFinder::SUCCESS, false,
|
findTest(origin_, RRType::NS(), ZoneFinder::SUCCESS, false,
|
||||||
ConstRRsetPtr(), NULL, &finder2);
|
ConstRRsetPtr(), &finder2);
|
||||||
findTest(other_origin, RRType::TXT(), ZoneFinder::NXDOMAIN, false,
|
findTest(other_origin, RRType::TXT(), ZoneFinder::NXDOMAIN, false,
|
||||||
ConstRRsetPtr(), NULL, &finder2);
|
ConstRRsetPtr(), &finder2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(InMemoryZoneFinderTest, getFileName) {
|
TEST_F(InMemoryZoneFinderTest, getFileName) {
|
||||||
|
@@ -237,9 +237,6 @@ public:
|
|||||||
/// a successful match, and the code of \c SUCCESS will be returned.
|
/// a successful match, and the code of \c SUCCESS will be returned.
|
||||||
/// - If the search name matches a delegation point of DNAME, it returns
|
/// - If the search name matches a delegation point of DNAME, it returns
|
||||||
/// the code of \c DNAME and that DNAME RR.
|
/// the code of \c DNAME and that DNAME RR.
|
||||||
/// - If the target isn't NULL, all RRsets under the domain are inserted
|
|
||||||
/// there and SUCCESS (or NXDOMAIN, in case of empty domain) is returned
|
|
||||||
/// instead of normall processing. This is intended to handle ANY query.
|
|
||||||
///
|
///
|
||||||
/// \note This behavior is controversial as we discussed in
|
/// \note This behavior is controversial as we discussed in
|
||||||
/// https://lists.isc.org/pipermail/bind10-dev/2011-January/001918.html
|
/// https://lists.isc.org/pipermail/bind10-dev/2011-January/001918.html
|
||||||
@@ -273,13 +270,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param name The domain name to be searched for.
|
/// \param name The domain name to be searched for.
|
||||||
/// \param type The RR type to be searched for.
|
/// \param type The RR type to be searched for.
|
||||||
/// \param target If target is not NULL, insert all RRs under the domain
|
|
||||||
/// into it.
|
|
||||||
/// \param options The search options.
|
/// \param options The search options.
|
||||||
/// \return A \c FindResult object enclosing the search result (see above).
|
/// \return A \c FindResult object enclosing the search result (see above).
|
||||||
virtual FindResult find(const isc::dns::Name& name,
|
virtual FindResult find(const isc::dns::Name& name,
|
||||||
const isc::dns::RRType& type,
|
const isc::dns::RRType& type,
|
||||||
isc::dns::RRsetList* target = NULL,
|
|
||||||
const FindOptions options
|
const FindOptions options
|
||||||
= FIND_DEFAULT) = 0;
|
= FIND_DEFAULT) = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user