Commit 2e940ea6 authored by JINMEI Tatuya's avatar JINMEI Tatuya

[master] Merge branch 'trac1607' with fixing conflicts:

	src/lib/datasrc/tests/Makefile.am
auth_srv_unittest.cc needed an adjustment, but I believe it's trivial,
so I'm commiting and pushing it.
parents 4a82ece4 516e15b8
This diff is collapsed.
......@@ -15,8 +15,11 @@
*/
#include <exceptions/exceptions.h>
#include <dns/rrset.h>
#include <datasrc/zone.h>
#include <vector>
namespace isc {
namespace dns {
class Message;
......@@ -96,7 +99,7 @@ private:
/// data
/// \param db_result The ZoneFinder::FindResult returned by find()
void addNXRRsetProof(isc::datasrc::ZoneFinder& finder,
const isc::datasrc::ZoneFinder::FindResult& db_result);
const isc::datasrc::ZoneFinder::Context& db_context);
/// Add NSEC RRs that prove an NXDOMAIN result.
///
......@@ -115,7 +118,7 @@ private:
/// of RFC5155.
void addWildcardProof(
isc::datasrc::ZoneFinder& finder,
const isc::datasrc::ZoneFinder::FindResult& dbResult);
const isc::datasrc::ZoneFinder::Context& db_context);
/// \brief Adds one NSEC RR proved no matched QNAME,one NSEC RR proved no
/// matched <QNAME,QTYPE> through wildcard extension.
......@@ -129,44 +132,6 @@ private:
void addWildcardNXRRSETProof(isc::datasrc::ZoneFinder& finder,
isc::dns::ConstRRsetPtr nsec);
/// \brief Look up additional data (i.e., address records for the names
/// included in NS or MX records) and add them to the additional section.
///
/// Note: Any additional data which has already been provided in the
/// answer section (i.e., if the original query happend to be for the
/// address of the DNS server), it should be omitted from the additional.
///
/// This method may throw a exception because its underlying methods may
/// throw exceptions.
///
/// \param zone The ZoneFinder through which the additional data for the
/// query is to be found.
/// \param rrset The RRset (i.e., NS or MX rrset) which require additional
/// processing.
void addAdditional(isc::datasrc::ZoneFinder& zone,
const isc::dns::AbstractRRset& rrset);
/// \brief Find address records for a specified name.
///
/// Search the specified zone for AAAA/A RRs of each of the NS/MX RDATA
/// (domain name), and insert the found ones into the additional section
/// if address records are available. By default the search will stop
/// once it encounters a zone cut.
///
/// Note: we need to perform the search in the "GLUE OK" mode for NS RDATA,
/// which means that we should include A/AAAA RRs under a zone cut.
/// The glue records must exactly match the name in the NS RDATA, without
/// CNAME or wildcard processing.
///
/// \param zone The \c ZoneFinder through which the address records is to
/// be found.
/// \param qname The name in rrset RDATA.
/// \param options The search options.
void addAdditionalAddrs(isc::datasrc::ZoneFinder& zone,
const isc::dns::Name& qname,
const isc::datasrc::ZoneFinder::FindOptions options
= isc::datasrc::ZoneFinder::FIND_DEFAULT);
/// \brief Look up a zone's NS RRset and their address records for an
/// authoritative answer, and add them to the additional section.
///
......@@ -185,7 +150,8 @@ private:
///
/// \param finder The \c ZoneFinder through which the NS and additional
/// data for the query are to be found.
void addAuthAdditional(isc::datasrc::ZoneFinder& finder);
void addAuthAdditional(isc::datasrc::ZoneFinder& finder,
std::vector<isc::dns::ConstRRsetPtr>& additionals);
/// \brief Process a DS query possible at the child side of zone cut.
///
......
......@@ -1135,7 +1135,7 @@ public:
return (real_zone_finder_->getClass());
}
virtual isc::datasrc::ZoneFinder::FindResult
virtual isc::datasrc::ZoneFinderContextPtr
find(const isc::dns::Name& name,
const isc::dns::RRType& type,
isc::datasrc::ZoneFinder::FindOptions options)
......@@ -1144,20 +1144,20 @@ public:
return (real_zone_finder_->find(name, type, options));
}
virtual FindResult
virtual isc::datasrc::ZoneFinderContextPtr
findAll(const isc::dns::Name& name,
std::vector<isc::dns::ConstRRsetPtr> &target,
const FindOptions options = FIND_DEFAULT)
{
checkThrow(THROW_AT_FIND_ALL, throw_when_, isc_exception_);
return (real_zone_finder_->findAll(name, target, options));
};
}
virtual FindNSEC3Result
findNSEC3(const isc::dns::Name& name, bool recursive) {
checkThrow(THROW_AT_FIND_NSEC3, throw_when_, isc_exception_);
return (real_zone_finder_->findNSEC3(name, recursive));
};
}
virtual isc::dns::Name
findPreviousName(const isc::dns::Name& query) const {
......
......@@ -176,16 +176,16 @@ zoneChecks(AuthSrv& server) {
EXPECT_TRUE(server.getInMemoryClient(RRClass::IN()));
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::A()).code);
find(Name("ns.test1.example"), RRType::A())->code);
EXPECT_EQ(ZoneFinder::NXRRSET, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::AAAA()).code);
find(Name("ns.test1.example"), RRType::AAAA())->code);
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::A()).code);
find(Name("ns.test2.example"), RRType::A())->code);
EXPECT_EQ(ZoneFinder::NXRRSET, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::AAAA()).code);
find(Name("ns.test2.example"), RRType::AAAA())->code);
}
void
......@@ -213,19 +213,19 @@ newZoneChecks(AuthSrv& server) {
EXPECT_TRUE(server.getInMemoryClient(RRClass::IN()));
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::A()).code);
find(Name("ns.test1.example"), RRType::A())->code);
// now test1.example should have ns/AAAA
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::AAAA()).code);
find(Name("ns.test1.example"), RRType::AAAA())->code);
// test2.example shouldn't change
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::A()).code);
find(Name("ns.test2.example"), RRType::A())->code);
EXPECT_EQ(ZoneFinder::NXRRSET, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::AAAA()).code);
find(Name("ns.test2.example"), RRType::AAAA())->code);
}
TEST_F(AuthCommandTest, loadZone) {
......
......@@ -191,7 +191,7 @@ TEST_F(MemoryDatasrcConfigTest, addOneZone) {
// Check it actually loaded something
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(rrclass)->findZone(
Name("ns.example.com.")).zone_finder->find(Name("ns.example.com."),
RRType::A()).code);
RRType::A())->code);
}
TEST_F(MemoryDatasrcConfigTest, addMultiZones) {
......
......@@ -370,12 +370,14 @@ public:
}
virtual isc::dns::Name getOrigin() const { return (origin_); }
virtual isc::dns::RRClass getClass() const { return (rrclass_); }
virtual FindResult find(const isc::dns::Name& name,
const isc::dns::RRType& type,
const FindOptions options = FIND_DEFAULT);
virtual FindResult findAll(const isc::dns::Name& name,
std::vector<ConstRRsetPtr>& target,
const FindOptions options = FIND_DEFAULT);
virtual ZoneFinderContextPtr find(const isc::dns::Name& name,
const isc::dns::RRType& type,
const FindOptions options =
FIND_DEFAULT);
virtual ZoneFinderContextPtr findAll(const isc::dns::Name& name,
std::vector<ConstRRsetPtr>& target,
const FindOptions options =
FIND_DEFAULT);
virtual ZoneFinder::FindNSEC3Result
findNSEC3(const Name& name, bool recursive);
......@@ -397,8 +399,10 @@ public:
ConstRRsetPtr rrset)
{
nsec_name_ = nsec_name;
nsec_result_.reset(new ZoneFinder::FindResult(code, rrset,
RESULT_NSEC_SIGNED));
nsec_context_.reset(new Context(*this,
FIND_DEFAULT, // a fake value
ResultContext(code, rrset,
RESULT_NSEC_SIGNED)));
}
// Once called, the findNSEC3 will return the provided result for the next
......@@ -435,6 +439,18 @@ public:
ConstRRsetPtr dname_rrset_; // could be used as an arbitrary bogus RRset
ConstRRsetPtr empty_nsec_rrset_;
protected:
// A convenient shortcut. Will also be used by further derived mocks.
ZoneFinderContextPtr createContext(FindOptions options,
Result code,
isc::dns::ConstRRsetPtr rrset,
FindResultFlags flags = RESULT_DEFAULT)
{
return (ZoneFinderContextPtr(
new Context(*this, options,
ResultContext(code, rrset, flags))));
}
private:
typedef map<RRType, ConstRRsetPtr> RRsetStore;
typedef map<Name, RRsetStore> Domains;
......@@ -505,7 +521,7 @@ private:
bool use_nsec3_;
// The following two will be used for faked NSEC cases
Name nsec_name_;
boost::scoped_ptr<ZoneFinder::FindResult> nsec_result_;
ZoneFinderContextPtr nsec_context_;
// The following two are for faking bad NSEC3 responses
// Enabled when not NULL
const FindNSEC3Result* nsec3_fake_;
......@@ -533,12 +549,12 @@ substituteWild(const AbstractRRset& wild_rrset, const Name& real_name) {
return (rrset);
}
ZoneFinder::FindResult
ZoneFinderContextPtr
MockZoneFinder::findAll(const Name& name, std::vector<ConstRRsetPtr>& target,
const FindOptions options)
{
ZoneFinder::FindResult result(find(name, RRType::ANY(), options));
if (result.code == NXRRSET) {
ZoneFinderContextPtr result(find(name, RRType::ANY(), options));
if (result->code == NXRRSET) {
const Domains::const_iterator found_domain = domains_.find(name);
if (!found_domain->second.empty()) {
for (RRsetStore::const_iterator found_rrset =
......@@ -547,7 +563,10 @@ MockZoneFinder::findAll(const Name& name, std::vector<ConstRRsetPtr>& target,
// Insert RRs under the domain name into target
target.push_back(found_rrset->second);
}
return (FindResult(SUCCESS, RRsetPtr()));
return (ZoneFinderContextPtr(
new Context(*this, options,
ResultContext(SUCCESS, RRsetPtr()),
target)));
}
}
......@@ -610,16 +629,16 @@ MockZoneFinder::findNSEC3(const Name& name, bool recursive) {
isc_throw(isc::Unexpected, "findNSEC3() isn't expected to fail");
}
ZoneFinder::FindResult
ZoneFinderContextPtr
MockZoneFinder::find(const Name& name, const RRType& type,
const FindOptions options)
{
// Emulating a broken zone: mandatory apex RRs are missing if specifically
// configured so (which are rare cases).
if (name == origin_ && type == RRType::SOA() && !has_SOA_) {
return (FindResult(NXDOMAIN, RRsetPtr()));
return (createContext(options, NXDOMAIN, RRsetPtr()));
} else if (name == origin_ && type == RRType::NS() && !has_apex_NS_) {
return (FindResult(NXDOMAIN, RRsetPtr()));
return (createContext(options, NXDOMAIN, RRsetPtr()));
}
// Special case for names on or under a zone cut and under DNAME
......@@ -634,11 +653,11 @@ MockZoneFinder::find(const Name& name, const RRType& type,
// handled just like an in-zone case below. Others result in
// DELEGATION.
if (type != RRType::DS() || it->first != name) {
return (FindResult(DELEGATION, delegation_ns));
return (createContext(options, DELEGATION, delegation_ns));
}
} else if (name.compare(dname_name_).getRelation() ==
NameComparisonResult::SUBDOMAIN) {
return (FindResult(DNAME, dname_rrset_));
return (createContext(options, DNAME, dname_rrset_));
}
// normal cases. names are searched for only per exact-match basis
......@@ -668,33 +687,35 @@ MockZoneFinder::find(const Name& name, const RRType& type,
}
rrset = noconst;
}
return (FindResult(SUCCESS, rrset));
return (createContext(options, SUCCESS, rrset));
}
// Otherwise, if this domain name has CNAME, return it.
found_rrset = found_domain->second.find(RRType::CNAME());
if (found_rrset != found_domain->second.end()) {
return (FindResult(CNAME, found_rrset->second));
return (createContext(options, CNAME, found_rrset->second));
}
// Otherwise it's NXRRSET case...
// ...but a special pathological case first:
if (found_domain->first == bad_signed_delegation_name_ &&
type == RRType::DS()) {
return (FindResult(NXDOMAIN, RRsetPtr()));
return (createContext(options, NXDOMAIN, RRsetPtr()));
}
// normal cases follow.
if ((options & FIND_DNSSEC) != 0) {
if (use_nsec3_) {
return (FindResult(NXRRSET, RRsetPtr(), RESULT_NSEC3_SIGNED));
return (createContext(options, NXRRSET, RRsetPtr(),
RESULT_NSEC3_SIGNED));
}
found_rrset = found_domain->second.find(RRType::NSEC());
if (found_rrset != found_domain->second.end()) {
return (FindResult(NXRRSET, found_rrset->second,
RESULT_NSEC_SIGNED));
return (createContext(options, NXRRSET, found_rrset->second,
RESULT_NSEC_SIGNED));
}
}
return (FindResult(NXRRSET, RRsetPtr(), RESULT_NSEC_SIGNED));
return (createContext(options, NXRRSET, RRsetPtr(),
RESULT_NSEC_SIGNED));
}
// query name isn't found in our domains.
......@@ -714,16 +735,17 @@ MockZoneFinder::find(const Name& name, const RRType& type,
--domain; // reset domain to the "previous name"
if ((options & FIND_DNSSEC) != 0) {
if (use_nsec3_) {
return (FindResult(NXRRSET, RRsetPtr(), RESULT_NSEC3_SIGNED));
return (createContext(options, NXRRSET, RRsetPtr(),
RESULT_NSEC3_SIGNED));
}
RRsetStore::const_iterator found_rrset =
(*domain).second.find(RRType::NSEC());
if (found_rrset != (*domain).second.end()) {
return (FindResult(NXRRSET, found_rrset->second,
RESULT_NSEC_SIGNED));
return (createContext(options, NXRRSET, found_rrset->second,
RESULT_NSEC_SIGNED));
}
}
return (FindResult(NXRRSET, RRsetPtr()));
return (createContext(options, NXRRSET, RRsetPtr()));
}
// Another possibility is wildcard. For simplicity we only check
......@@ -746,39 +768,37 @@ MockZoneFinder::find(const Name& name, const RRType& type,
domain->second.find(type);
// Matched the QTYPE
if(found_rrset != domain->second.end()) {
return (FindResult(SUCCESS,
substituteWild(
*found_rrset->second, name),
RESULT_WILDCARD |
(use_nsec3_ ?
RESULT_NSEC3_SIGNED :
RESULT_NSEC_SIGNED)));
return (createContext(options,SUCCESS, substituteWild(
*found_rrset->second, name),
RESULT_WILDCARD |
(use_nsec3_ ?
RESULT_NSEC3_SIGNED :
RESULT_NSEC_SIGNED)));
} else {
// No matched QTYPE, this case is for NXRRSET with
// WILDCARD
if (use_nsec3_) {
return (FindResult(NXRRSET, RRsetPtr(),
RESULT_WILDCARD |
RESULT_NSEC3_SIGNED));
return (createContext(options, NXRRSET, RRsetPtr(),
RESULT_WILDCARD |
RESULT_NSEC3_SIGNED));
}
const Name new_name =
Name("*").concatenate(wild_suffix);
found_rrset = domain->second.find(RRType::NSEC());
assert(found_rrset != domain->second.end());
return (FindResult(NXRRSET,
substituteWild(
*found_rrset->second,
new_name),
RESULT_WILDCARD |
RESULT_NSEC_SIGNED));
return (createContext(options, NXRRSET, substituteWild(
*found_rrset->second,
new_name),
RESULT_WILDCARD |
RESULT_NSEC_SIGNED));
}
} else {
// This is empty non terminal name case on wildcard.
const Name empty_name = Name("*").concatenate(wild_suffix);
if (use_nsec3_) {
return (FindResult(NXRRSET, RRsetPtr(),
RESULT_WILDCARD |
RESULT_NSEC3_SIGNED));
return (createContext(options, NXRRSET, RRsetPtr(),
RESULT_WILDCARD |
RESULT_NSEC3_SIGNED));
}
for (Domains::reverse_iterator it = domains_.rbegin();
it != domains_.rend();
......@@ -787,13 +807,15 @@ MockZoneFinder::find(const Name& name, const RRType& type,
if ((*it).first < empty_name &&
(nsec_it = (*it).second.find(RRType::NSEC()))
!= (*it).second.end()) {
return (FindResult(NXRRSET, (*nsec_it).second,
RESULT_WILDCARD |
RESULT_NSEC_SIGNED));
return (createContext(options, NXRRSET,
(*nsec_it).second,
RESULT_WILDCARD |
RESULT_NSEC_SIGNED));
}
}
}
return (FindResult(NXRRSET, RRsetPtr(), RESULT_WILDCARD));
return (createContext(options, NXRRSET, RRsetPtr(),
RESULT_WILDCARD));
}
}
const Name cnamewild_suffix("cnamewild.example.com");
......@@ -804,11 +826,11 @@ MockZoneFinder::find(const Name& name, const RRType& type,
RRsetStore::const_iterator found_rrset =
domain->second.find(RRType::CNAME());
assert(found_rrset != domain->second.end());
return (FindResult(CNAME,
substituteWild(*found_rrset->second, name),
RESULT_WILDCARD |
(use_nsec3_ ? RESULT_NSEC3_SIGNED :
RESULT_NSEC_SIGNED)));
return (createContext(options, CNAME,
substituteWild(*found_rrset->second, name),
RESULT_WILDCARD |
(use_nsec3_ ? RESULT_NSEC3_SIGNED :
RESULT_NSEC_SIGNED)));
}
}
......@@ -821,12 +843,13 @@ MockZoneFinder::find(const Name& name, const RRType& type,
// than the origin)
if ((options & FIND_DNSSEC) != 0) {
if (use_nsec3_) {
return (FindResult(NXDOMAIN, RRsetPtr(), RESULT_NSEC3_SIGNED));
return (createContext(options, NXDOMAIN, RRsetPtr(),
RESULT_NSEC3_SIGNED));
}
// Emulate a broken DataSourceClient for some special names.
if (nsec_result_ && nsec_name_ == name) {
return (*nsec_result_);
if (nsec_context_ && nsec_name_ == name) {
return (nsec_context_);
}
// Normal case
......@@ -839,12 +862,12 @@ MockZoneFinder::find(const Name& name, const RRType& type,
if ((*it).first < name &&
(nsec_it = (*it).second.find(RRType::NSEC()))
!= (*it).second.end()) {
return (FindResult(NXDOMAIN, (*nsec_it).second,
RESULT_NSEC_SIGNED));
return (createContext(options, NXDOMAIN, (*nsec_it).second,
RESULT_NSEC_SIGNED));
}
}
}
return (FindResult(NXDOMAIN, RRsetPtr()));
return (createContext(options,NXDOMAIN, RRsetPtr()));
}
class QueryTest : public ::testing::Test {
......@@ -1117,7 +1140,6 @@ TEST_F(QueryTest, secureUnsignedDelegationWithNSEC3OptOut) {
// proof (and their RRSIGs). The closest encloser is the apex (origin),
// and with our faked hash the covering NSEC3 for the next closer
// (= child zone name) is that for www.example.com.
cout << response << endl;
responseCheck(response, Rcode::NOERROR(), 0, 0, 5, 0,
NULL,
(string(unsigned_delegation_txt) +
......@@ -1962,23 +1984,23 @@ public:
MockZoneFinder(), origin_(origin), have_ds_(have_ds)
{}
virtual isc::dns::Name getOrigin() const { return (origin_); }
virtual FindResult find(const isc::dns::Name&,
const isc::dns::RRType& type,
const FindOptions)
virtual ZoneFinderContextPtr find(const isc::dns::Name&,
const isc::dns::RRType& type,
const FindOptions options)
{
if (type == RRType::SOA()) {
RRsetPtr soa = textToRRset(origin_.toText() + " 3600 IN SOA . . "
"0 0 0 0 0\n", origin_);
soa->addRRsig(RdataPtr(new generic::RRSIG(
getCommonRRSIGText("SOA"))));
return (FindResult(SUCCESS, soa));
return (createContext(options, SUCCESS, soa));
}
if (type == RRType::NS()) {
RRsetPtr ns = textToRRset(origin_.toText() + " 3600 IN NS " +
Name("ns").concatenate(origin_).toText());
ns->addRRsig(RdataPtr(new generic::RRSIG(
getCommonRRSIGText("NS"))));
return (FindResult(SUCCESS, ns));
return (createContext(options, SUCCESS, ns));
}
if (type == RRType::DS()) {
if (have_ds_) {
......@@ -1988,7 +2010,7 @@ public:
"3CD34AC1AFE51DE");
ds->addRRsig(RdataPtr(new generic::RRSIG(
getCommonRRSIGText("DS"))));
return (FindResult(SUCCESS, ds));
return (createContext(options, SUCCESS, ds));
} else {
RRsetPtr nsec = textToRRset(origin_.toText() +
" 3600 IN NSEC " +
......@@ -1996,12 +2018,13 @@ public:
" SOA NSEC RRSIG");
nsec->addRRsig(RdataPtr(new generic::RRSIG(
getCommonRRSIGText("NSEC"))));
return (FindResult(NXRRSET, nsec, RESULT_NSEC_SIGNED));
return (createContext(options, NXRRSET, nsec,
RESULT_NSEC_SIGNED));
}
}
// Returning NXDOMAIN is not correct, but doesn't matter for our tests.
return (FindResult(NXDOMAIN, ConstRRsetPtr()));
return (createContext(options, NXDOMAIN, ConstRRsetPtr()));
}
private:
const Name origin_;
......@@ -2311,11 +2334,11 @@ TEST_F(QueryTest, nxdomainWithBadWildcardNSEC3Proof) {
// clean them up.
TEST_F(QueryTest, emptyNameWithNSEC3) {
mock_finder->setNSEC3Flag(true);
ZoneFinder::FindResult result = mock_finder->find(
ZoneFinderContextPtr result = mock_finder->find(
Name("no.example.com"), RRType::A(), ZoneFinder::FIND_DNSSEC);
EXPECT_EQ(ZoneFinder::NXRRSET, result.code);
EXPECT_FALSE(result.rrset);
EXPECT_TRUE(result.isNSEC3Signed());
EXPECT_FALSE(result.isWildcard());
EXPECT_EQ(ZoneFinder::NXRRSET, result->code);
EXPECT_FALSE(result->rrset);
EXPECT_TRUE(result->isNSEC3Signed());
EXPECT_FALSE(result->isWildcard());
}
}
......@@ -24,7 +24,7 @@ libdatasrc_la_SOURCES += cache.h cache.cc
libdatasrc_la_SOURCES += rbnode_rrset.h
libdatasrc_la_SOURCES += rbtree.h
libdatasrc_la_SOURCES += zonetable.h zonetable.cc
libdatasrc_la_SOURCES += zone.h
libdatasrc_la_SOURCES += zone.h zone_finder_context.cc
libdatasrc_la_SOURCES += result.h
libdatasrc_la_SOURCES += logger.h logger.cc
libdatasrc_la_SOURCES += client.h iterator.h
......@@ -35,6 +35,7 @@ nodist_libdatasrc_la_SOURCES = datasrc_messages.h datasrc_messages.cc
pkglib_LTLIBRARIES = sqlite3_ds.la memory_ds.la
sqlite3_ds_la_SOURCES = sqlite3_accessor.h sqlite3_accessor.cc
sqlite3_ds_la_SOURCES += sqlite3_accessor_link.cc
sqlite3_ds_la_LDFLAGS = -module
sqlite3_ds_la_LDFLAGS += -no-undefined -version-info 1:0:0
sqlite3_ds_la_LIBADD = $(top_builddir)/src/lib/exceptions/libexceptions.la
......@@ -42,6 +43,7 @@ sqlite3_ds_la_LIBADD += libdatasrc.la
sqlite3_ds_la_LIBADD += $(SQLITE_LIBS)
memory_ds_la_SOURCES = memory_datasrc.h memory_datasrc.cc
memory_ds_la_SOURCES += memory_datasrc_link.cc
memory_ds_la_LDFLAGS = -module
memory_ds_la_LIBADD = $(top_builddir)/src/lib/exceptions/libexceptions.la
memory_ds_la_LIBADD += libdatasrc.la
......
......@@ -396,15 +396,18 @@ DatabaseClient::Finder::findNSECCover(const Name& name) {
return (ConstRRsetPtr());
}
ZoneFinder::FindResult
ZoneFinderContextPtr
DatabaseClient::Finder::findAll(const isc::dns::Name& name,
std::vector<isc::dns::ConstRRsetPtr>& target,
const FindOptions options)
{
return (findInternal(name, RRType::ANY(), &target, options));
return (ZoneFinderContextPtr(new Context(*this, options,
findInternal(name, RRType::ANY(),
&target, options),
target)));
}
ZoneFinder::FindResult
ZoneFinderContextPtr
DatabaseClient::Finder::find(const isc::dns::Name& name,
const isc::dns::RRType& type,
const FindOptions options)
......@@ -412,7 +415,9 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
if (type == RRType::ANY()) {
isc_throw(isc::Unexpected, "Use findAll to answer ANY");
}
return (findInternal(name, type, NULL, options));
return (ZoneFinderContextPtr(new Context(*this, options,
findInternal(name, type,
NULL, options))));
}
DatabaseClient::Finder::DelegationSearchResult
......@@ -573,7 +578,7 @@ DatabaseClient::Finder::findDelegationPoint(const isc::dns::Name& name,
// covering NSEC record.
//
// If none of the above applies in any level, the search fails with NXDOMAIN.
ZoneFinder::FindResult
ZoneFinder::ResultContext
DatabaseClient::Finder::findWildcardMatch(
const isc::dns::Name& name, const isc::dns::RRType& type,
const FindOptions options, const DelegationSearchResult& dresult,
......@@ -616,8 +621,7 @@ DatabaseClient::Finder::findWildcardMatch(
DATASRC_DATABASE_WILDCARD_CANCEL_NS).
arg(accessor_->getDBName()).arg(wildcard).
arg(dresult.first_ns->getName());
return (FindResult(DELEGATION, dresult.first_ns));
return (ResultContext(DELEGATION, dresult.first_ns));
} else if (!hasSubdomains(name.split(i - 1).toText())) {
// The wildcard match is the best one, find the final result
// at it. Note that wildcard should never be the zone origin.
......@@ -630,7 +634,7 @@ DatabaseClient::Finder::findWildcardMatch(
DATASRC_DATABASE_WILDCARD_CANCEL_SUB).
arg(accessor_->getDBName()).arg(wildcard).
arg(name).arg(superdomain);
return (FindResult(NXDOMAIN, ConstRRsetPtr()));
return (ResultContext(NXDOMAIN, ConstRRsetPtr()));
}
} else if (hasSubdomains(wildcard)) {
......@@ -641,19 +645,20 @@ DatabaseClient::Finder::findWildcardMatch(
if ((options & FIND_DNSSEC) != 0) {
ConstRRsetPtr nsec = findNSECCover(Name(wildcard));
if (nsec) {
return (FindResult(NXRRSET, nsec,
RESULT_WILDCARD | RESULT_NSEC_SIGNED));
return (ResultContext(NXRRSET, nsec,
RESULT_WILDCARD |
RESULT_NSEC_SIGNED));
}
}
return (FindResult(NXRRSET, ConstRRsetPtr(), RESULT_WILDCARD));
return (ResultContext(NXRRSET, ConstRRsetPtr(), RESULT_WILDCARD));
}
}