BIND 10 trac1579, updated. c31cfdf8449030f874406f4efad754ba7eb786e6 [1579] editorial cleanups: shortened long lines, indentation consistency.
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Mar 30 23:43:41 UTC 2012
The branch, trac1579 has been updated
via c31cfdf8449030f874406f4efad754ba7eb786e6 (commit)
via cd6faa250e082808a86d9ccb1f11ea07ab81a618 (commit)
via 5893305969aec78850e2462859b3bf4b7a157057 (commit)
via 419665026524f1a1b46efba377d41bd1f7f806d0 (commit)
via ad0ce258df14fa88a299ef37238d4c2527f273c8 (commit)
via fa4aa9c87c599a985bb19b78ae3f2d1d4ab9bb63 (commit)
from 94793e41d922cb10e35e0ff146b19c38ace415b1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c31cfdf8449030f874406f4efad754ba7eb786e6
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Mar 30 16:43:01 2012 -0700
[1579] editorial cleanups: shortened long lines, indentation consistency.
commit cd6faa250e082808a86d9ccb1f11ea07ab81a618
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Mar 30 15:21:41 2012 -0700
[1579] folded a long line
commit 5893305969aec78850e2462859b3bf4b7a157057
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Mar 30 15:18:53 2012 -0700
[1579] more suggested editorial fixes: use boolean as boolean
commit 419665026524f1a1b46efba377d41bd1f7f806d0
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Mar 30 15:12:58 2012 -0700
[1579] some more suggested editorial fixes:
- use boolean as boolean: if (is_xx == true) => if (is_xx)
- spacing consistency if (X){ => if (X) { // (many of this in the branch)
- folded a long line
commit ad0ce258df14fa88a299ef37238d4c2527f273c8
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Mar 30 15:01:35 2012 -0700
[1579] editorial cleanup, mostly per the guidelines.
- folded long lines
- removed white space at EOL
- spacing consistency. in particular, add one space after comma
- alignment
commit fa4aa9c87c599a985bb19b78ae3f2d1d4ab9bb63
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Mar 30 14:36:22 2012 -0700
[1579] cancel unnecessary change (this will help reduce conflict on merge)
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/database.cc | 69 +++++++++++---------
src/lib/datasrc/database.h | 6 +-
src/lib/datasrc/tests/database_unittest.cc | 45 ++++++-------
.../datasrc/tests/zone_finder_context_unittest.cc | 1 +
4 files changed, 64 insertions(+), 57 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index c85047a..748b562 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -374,7 +374,7 @@ FINAL_TYPES_NO_NSEC() {
result.insert(RRType::CNAME());
result.insert(RRType::NS());
initialized = true;
- }
+ }
return (result);
}
@@ -424,15 +424,17 @@ DatabaseClient::Finder::findAll(const isc::dns::Name& name,
const FindOptions options)
{
const bool need_nsec3 = (((options & FIND_DNSSEC) != 0) && isNSEC3());
- if ((need_nsec3 == true) && (isNSEC() == true)){
- isc_throw(DataSourceError, "nsec and nsec3 coexist");
+ if (need_nsec3 && isNSEC()) {
+ isc_throw(DataSourceError, "nsec and nsec3 coexist");
}
- // If the zone is signed with NSEC3, need to add RESULT_NSEC3_SIGNED to the flags
- // in FindContext when NXRRSET NXDOMAIN or WILDCARD in the DNSSEC query, no need
- // NSEC RRset at the same time.
+ // If the zone is signed with NSEC3, need to add RESULT_NSEC3_SIGNED to the
+ // flags in FindContext when NXRRSET NXDOMAIN or WILDCARD in the DNSSEC
+ // query, no need NSEC RRset at the same time.
return (ZoneFinderContextPtr(new Context(*this, options,
- findInternal(name, RRType::ANY(), &target,
- options, need_nsec3),target)));
+ findInternal(name, RRType::ANY(),
+ &target, options,
+ need_nsec3),
+ target)));
}
ZoneFinderContextPtr
@@ -443,16 +445,17 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
if (type == RRType::ANY()) {
isc_throw(isc::Unexpected, "Use findAll to answer ANY");
}
- // If the zone is signed with NSEC3, need to add RESULT_NSEC3_SIGNED to the flags
- // in FindContext when NXRRSET NXDOMAIN or WILDCARD in the DNSSEC query, no need
- // NSEC RRset at the same time.
+ // If the zone is signed with NSEC3, need to add RESULT_NSEC3_SIGNED to the
+ // flags in FindContext when NXRRSET NXDOMAIN or WILDCARD in the DNSSEC
+ // query, no need NSEC RRset at the same time.
const bool need_nsec3 = (((options & FIND_DNSSEC) != 0) && isNSEC3());
- if ((need_nsec3 == true) && (isNSEC() == true)){
- isc_throw(DataSourceError, "nsec and nsec3 coexist");
+ if (need_nsec3 && isNSEC()) {
+ isc_throw(DataSourceError, "nsec and nsec3 coexist");
}
return (ZoneFinderContextPtr(new Context(*this, options,
- findInternal(name, type,
- NULL, options,need_nsec3))));
+ findInternal(name, type, NULL,
+ options,
+ need_nsec3))));
}
DatabaseClient::Finder::DelegationSearchResult
@@ -656,7 +659,7 @@ DatabaseClient::Finder::findWildcardMatch(
DATASRC_DATABASE_WILDCARD_CANCEL_NS).
arg(accessor_->getDBName()).arg(wildcard).
arg(dresult.first_ns->getName());
- return (ResultContext(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.
@@ -677,7 +680,7 @@ DatabaseClient::Finder::findWildcardMatch(
LOG_DEBUG(logger, DBG_TRACE_DETAILED,
DATASRC_DATABASE_WILDCARD_EMPTY).
arg(accessor_->getDBName()).arg(wildcard).arg(name);
- if (((options & FIND_DNSSEC) != 0) && (need_nsec3 == false)) {
+ if (((options & FIND_DNSSEC) != 0) && !need_nsec3) {
ConstRRsetPtr nsec = findNSECCover(Name(wildcard));
if (nsec) {
return (ResultContext(NXRRSET, nsec,
@@ -685,8 +688,9 @@ DatabaseClient::Finder::findWildcardMatch(
RESULT_NSEC_SIGNED));
}
}
- return (ResultContext(NXRRSET, ConstRRsetPtr(), need_nsec3 ?
- (RESULT_WILDCARD | RESULT_NSEC3_SIGNED) : RESULT_WILDCARD));
+ return (ResultContext(NXRRSET, ConstRRsetPtr(), need_nsec3 ?
+ (RESULT_WILDCARD | RESULT_NSEC3_SIGNED) :
+ RESULT_WILDCARD));
}
}
@@ -737,7 +741,7 @@ DatabaseClient::Finder::findOnNameResult(const Name& name,
const bool wild = (wildname != NULL);
FindResultFlags flags;
if (need_nsec3) {
- flags = wild ? (RESULT_WILDCARD | RESULT_NSEC3_SIGNED) :
+ flags = wild ? (RESULT_WILDCARD | RESULT_NSEC3_SIGNED) :
RESULT_DEFAULT;
} else {
flags = wild ? RESULT_WILDCARD : RESULT_DEFAULT;
@@ -753,7 +757,7 @@ DatabaseClient::Finder::findOnNameResult(const Name& name,
// TODO: this part should be revised when we support NSEC3; ideally we
// should use more effective and efficient way to identify (whether and)
// in which way the zone is signed.
- if (wild && (options & FIND_DNSSEC) != 0 && (need_nsec3 == false) &&
+ if (wild && (options & FIND_DNSSEC) != 0 && !need_nsec3 &&
found.second.find(RRType::NSEC()) != found.second.end()) {
flags = flags | RESULT_NSEC_SIGNED;
}
@@ -817,7 +821,7 @@ DatabaseClient::Finder::findOnNameResult(const Name& name,
// NSEC records in the name of the wildcard, not the substituted one,
// so we need to search the tree again.
ConstRRsetPtr nsec_rrset; // possibly used with DNSSEC, otherwise NULL
- if ((options & FIND_DNSSEC) != 0 && (need_nsec3 == false)) {
+ if ((options & FIND_DNSSEC) != 0 && !need_nsec3) {
if (wild) {
const FoundRRsets wfound = getRRsets(*wildname, NSEC_TYPES(),
true);
@@ -841,8 +845,8 @@ DatabaseClient::Finder::findOnNameResult(const Name& name,
}
return (logAndCreateResult(name, wildname, type, NXRRSET, nsec_rrset,
wild ? DATASRC_DATABASE_WILDCARD_NXRRSET :
- DATASRC_DATABASE_FOUND_NXRRSET, need_nsec3?
- (flags | RESULT_NSEC3_SIGNED):flags));
+ DATASRC_DATABASE_FOUND_NXRRSET, need_nsec3 ?
+ (flags | RESULT_NSEC3_SIGNED) : flags));
}
ZoneFinder::ResultContext
@@ -853,7 +857,7 @@ DatabaseClient::Finder::findNoNameResult(const Name& name, const RRType& type,
target, const bool need_nsec3)
{
const bool dnssec_data = ((options & FIND_DNSSEC) != 0);
- const bool need_nsec = ((dnssec_data == true) && (need_nsec3 == false));
+ const bool need_nsec = (dnssec_data && !need_nsec3);
// On entry to this method, we know that the database doesn't have any
// entry for this name. Before returning NXDOMAIN, we need to check
// for special cases.
@@ -875,7 +879,8 @@ DatabaseClient::Finder::findNoNameResult(const Name& name, const RRType& type,
// (i.e. all results except NXDOMAIN) return it; otherwise fall
// through to the NXDOMAIN case below.
const ResultContext wcontext =
- findWildcardMatch(name, type, options, dresult, target, need_nsec3);
+ findWildcardMatch(name, type, options, dresult, target,
+ need_nsec3);
if (wcontext.code != NXDOMAIN) {
return (wcontext);
}
@@ -893,8 +898,7 @@ DatabaseClient::Finder::findNoNameResult(const Name& name, const RRType& type,
}
bool
-DatabaseClient::Finder::isNSEC3()
-{
+DatabaseClient::Finder::isNSEC3() {
// If an NSEC3PARAM RR exists at the zone apex, it's quite likely that
// the zone is signed with NSEC3. (If not the zone is more or less broken,
// but it's caller's responsibility how to handle such cases).
@@ -905,8 +909,7 @@ DatabaseClient::Finder::isNSEC3()
}
bool
-DatabaseClient::Finder::isNSEC()
-{
+DatabaseClient::Finder::isNSEC() {
// If an NSEC RRsets exists at the zone apex, it's quite likely that
// the zone is signed with NSEC. (If not the zone is more or less broken,
// but it's caller's responsibility how to handle such cases)
@@ -919,7 +922,8 @@ DatabaseClient::Finder::isNSEC()
ZoneFinder::ResultContext
DatabaseClient::Finder::findInternal(const Name& name, const RRType& type,
std::vector<ConstRRsetPtr>* target,
- const FindOptions options, const bool is_nsec3)
+ const FindOptions options,
+ const bool is_nsec3)
{
LOG_DEBUG(logger, DBG_TRACE_DETAILED, DATASRC_DATABASE_FIND_RECORDS)
.arg(accessor_->getDBName()).arg(name).arg(type).arg(getClass());
@@ -971,7 +975,8 @@ DatabaseClient::Finder::findInternal(const Name& name, const RRType& type,
} else {
// Did not find anything at all at the domain name, so check for
// subdomains or wildcards.
- return (findNoNameResult(name, type, options, dresult, target, is_nsec3));
+ return (findNoNameResult(name, type, options, dresult, target,
+ is_nsec3));
}
}
diff --git a/src/lib/datasrc/database.h b/src/lib/datasrc/database.h
index 6bffd80..b9421ca 100644
--- a/src/lib/datasrc/database.h
+++ b/src/lib/datasrc/database.h
@@ -712,11 +712,13 @@ public:
/// searches the NSEC3PARAM RRset in the zone apex, if it exists, the
/// zone looks signed with nsec3
bool isNSEC3();
+
/// \brief check whether zone is signed with nsec
///
- /// searches the NSEC RRset in the zone apex, if it exists, the
+ /// searches the NSEC RRset in the zone apex, if it exists, the
/// zone looks signed with nsec
bool isNSEC();
+
/// \brief Find an RRset in the datasource
///
/// Searches the datasource for an RRset of the given name and
@@ -965,7 +967,7 @@ public:
const isc::dns::RRType& type,
const FindOptions options,
const DelegationSearchResult& dresult,
- std::vector<isc::dns::ConstRRsetPtr>* target,
+ std::vector<isc::dns::ConstRRsetPtr>* target,
const bool need_nsec3);
/// \brief Handle matching results for name
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index 822ef3f..3c1e892 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -1460,7 +1460,7 @@ doFindAllTestResult(ZoneFinder& finder, const isc::dns::Name& name,
const isc::dns::Name& expected_name =
isc::dns::Name::ROOT_NAME(),
const ZoneFinder::FindOptions options =
- ZoneFinder::FIND_DEFAULT,
+ ZoneFinder::FIND_DEFAULT,
ZoneFinder::FindResultFlags expected_flags =
ZoneFinder::RESULT_DEFAULT)
{
@@ -2329,10 +2329,10 @@ TYPED_TEST(DatabaseClientTest, dbNegativeCaseFind) {
"FAKEFAKEFAKE");
doFindTest(*finder, isc::dns::Name("b.a.wild.example.org"),
isc::dns::RRType::A(), isc::dns::RRType::A(),
- this->rrttl_, ZoneFinder::SUCCESS, this->expected_rdatas_,
+ this->rrttl_, ZoneFinder::SUCCESS, this->expected_rdatas_,
this->expected_sig_rdatas_,
(ZoneFinder::RESULT_WILDCARD | ZoneFinder::RESULT_NSEC_SIGNED),
- isc::dns::Name("b.a.wild.example.org"), ZoneFinder::FIND_DNSSEC);
+ Name("b.a.wild.example.org"), ZoneFinder::FIND_DNSSEC);
this->expected_rdatas_.clear();
this->expected_sig_rdatas_.clear();
this->expected_rdatas_.push_back("cancel.here.wild.example.org. A NSEC "
@@ -2343,9 +2343,9 @@ TYPED_TEST(DatabaseClientTest, dbNegativeCaseFind) {
doFindTest(*finder, isc::dns::Name("b.a.wild.example.org"),
isc::dns::RRType::TXT(), isc::dns::RRType::NSEC(),
this->rrttl_, ZoneFinder::NXRRSET, this->expected_rdatas_,
- this->expected_sig_rdatas_, (ZoneFinder::RESULT_WILDCARD |
- ZoneFinder::RESULT_NSEC_SIGNED),Name("*.wild.example.org"),
- ZoneFinder::FIND_DNSSEC);
+ this->expected_sig_rdatas_,
+ (ZoneFinder::RESULT_WILDCARD | ZoneFinder::RESULT_NSEC_SIGNED),
+ Name("*.wild.example.org"), ZoneFinder::FIND_DNSSEC);
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->rrset_.reset(new RRset(this->zname_, this->qclass_,
isc::dns::RRType::NSEC3PARAM(), this->rrttl_));
@@ -2356,11 +2356,11 @@ TYPED_TEST(DatabaseClientTest, dbNegativeCaseFind) {
try {
this->expected_rdatas_.clear();
this->expected_sig_rdatas_.clear();
- doFindTest(this->updater_->getFinder(), isc::dns::Name("www1.example.org."),
- this->qtype_, this->qtype_, this->rrttl_, ZoneFinder::NXDOMAIN,
- this->expected_rdatas_, this->expected_sig_rdatas_,
- ZoneFinder::RESULT_NSEC3_SIGNED, isc::dns::Name::ROOT_NAME(),
- ZoneFinder::FIND_DNSSEC);
+ doFindTest(this->updater_->getFinder(), Name("www1.example.org."),
+ this->qtype_, this->qtype_, this->rrttl_,
+ ZoneFinder::NXDOMAIN, this->expected_rdatas_,
+ this->expected_sig_rdatas_, ZoneFinder::RESULT_NSEC3_SIGNED,
+ Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC);
} catch (const DataSourceError&) {}
// The following test should be tested in zone which is signed by NSEC3
#if 0
@@ -2372,8 +2372,7 @@ TYPED_TEST(DatabaseClientTest, dbNegativeCaseFind) {
// test.
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->rrset_.reset(new RRset(this->zname_, this->qclass_,
- isc::dns::RRType::NSEC3PARAM(),
- this->rrttl_));
+ RRType::NSEC3PARAM(), this->rrttl_));
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"1 0 12 aabbccdd"));
@@ -2384,13 +2383,13 @@ TYPED_TEST(DatabaseClientTest, dbNegativeCaseFind) {
doFindTest(this->updater_->getFinder(),
isc::dns::Name("www1.example.org."), this->qtype_, this->qtype_,
this->rrttl_, ZoneFinder::NXDOMAIN, this->expected_rdatas_,
- this->expected_sig_rdatas_, ZoneFinder::RESULT_NSEC3_SIGNED,
+ this->expected_sig_rdatas_, ZoneFinder::RESULT_NSEC3_SIGNED,
isc::dns::Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC);
// check NXRRSET
this->expected_rdatas_.clear();
this->expected_sig_rdatas_.clear();
- doFindTest(this->updater_->getFinder(), isc::dns::Name("www.example.org."),
- isc::dns::RRType::TXT(), isc::dns::RRType::TXT(), this->rrttl_,
+ doFindTest(this->updater_->getFinder(), Name("www.example.org."),
+ RRType::TXT(), RRType::TXT(), this->rrttl_,
ZoneFinder::NXRRSET, this->expected_rdatas_,
this->expected_sig_rdatas_, ZoneFinder::RESULT_NSEC3_SIGNED,
isc::dns::Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC);
@@ -2399,20 +2398,20 @@ TYPED_TEST(DatabaseClientTest, dbNegativeCaseFind) {
this->expected_sig_rdatas_.push_back("A 5 3 3600 20000101000000 "
"20000201000000 12345 example.org. "
"FAKEFAKEFAKE");
- doFindTest(this->updater_->getFinder(), isc::dns::Name("b.a.wild.example.org"),
+ doFindTest(this->updater_->getFinder(), Name("b.a.wild.example.org"),
this->qtype_, this->qtype_, this->rrttl_, ZoneFinder::SUCCESS,
this->expected_rdatas_, this->expected_sig_rdatas_,
ZoneFinder::RESULT_WILDCARD | ZoneFinder::RESULT_NSEC3_SIGNED,
- isc::dns::Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC);
+ Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC);
// check flags if NXRRSET in wildcard case
this->expected_rdatas_.clear();
this->expected_sig_rdatas_.clear();
- doFindTest(this->updater_->getFinder(), isc::dns::Name("b.a.wild.example.org"),
- isc::dns::RRType::TXT(), isc::dns::RRType::TXT(),
- this->rrttl_, ZoneFinder::NXRRSET, this->expected_rdatas_,
- this->empty_rdatas_, (ZoneFinder::RESULT_WILDCARD |
+ doFindTest(this->updater_->getFinder(), Name("b.a.wild.example.org"),
+ RRType::TXT(), RRType::TXT(), this->rrttl_,
+ ZoneFinder::NXRRSET, this->expected_rdatas_,
+ this->empty_rdatas_, (ZoneFinder::RESULT_WILDCARD |
ZoneFinder::RESULT_NSEC3_SIGNED),
- isc::dns::Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC);
+ Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC);
#endif
}
diff --git a/src/lib/datasrc/tests/zone_finder_context_unittest.cc b/src/lib/datasrc/tests/zone_finder_context_unittest.cc
index cbd9095..5639f26 100644
--- a/src/lib/datasrc/tests/zone_finder_context_unittest.cc
+++ b/src/lib/datasrc/tests/zone_finder_context_unittest.cc
@@ -297,6 +297,7 @@ TEST_P(ZoneFinderContextTest, getAdditionalForAny) {
vector<ConstRRsetPtr> all_rrsets;
ZoneFinderContextPtr ctx = finder_->findAll(qzone_, all_rrsets);
EXPECT_EQ(ZoneFinder::SUCCESS, ctx->code);
+
ctx->getAdditional(REQUESTED_BOTH, result_sets_);
rrsetsCheck("ns1.example.org. 3600 IN A 192.0.2.1\n"
"ns1.example.org. 3600 IN AAAA 2001:db8::1\n"
More information about the bind10-changes
mailing list