BIND 10 trac3222, updated. 9a3ec0716d8ca77ce19cda435f79ccb19d06bef1 [3222] Made b10-dhcp-ddns server matching case insensitve
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Feb 20 20:30:11 UTC 2014
The branch, trac3222 has been updated
via 9a3ec0716d8ca77ce19cda435f79ccb19d06bef1 (commit)
from e6d57d893c8abb993158ba3621e087e6bd0d1b30 (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 9a3ec0716d8ca77ce19cda435f79ccb19d06bef1
Author: Thomas Markwalder <tmark at isc.org>
Date: Thu Feb 20 15:27:02 2014 -0500
[3222] Made b10-dhcp-ddns server matching case insensitve
The method used in D2 to match a FQDN (or reverse IP addrss)
to a list of servers, DdnsDomainListMgr::matchDomain(), was
made case insensitive.
-----------------------------------------------------------------------
Summary of changes:
src/bin/d2/d2_config.cc | 5 +++--
src/bin/d2/tests/d2_cfg_mgr_unittests.cc | 9 +++++++--
2 files changed, 10 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/d2/d2_config.cc b/src/bin/d2/d2_config.cc
index ca1aa4d..40909ed 100644
--- a/src/bin/d2/d2_config.cc
+++ b/src/bin/d2/d2_config.cc
@@ -20,6 +20,7 @@
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string/predicate.hpp>
#include <string>
@@ -131,7 +132,7 @@ DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) {
// If the lengths are identical and the names match we're done.
if (req_len == dom_len) {
- if (fqdn == domain_name) {
+ if (boost::iequals(fqdn,domain_name)) {
// exact match, done
domain = map_pair.second;
return (true);
@@ -143,7 +144,7 @@ DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) {
// prevents "onetwo.net" from matching "two.net".
size_t offset = req_len - dom_len;
if ((fqdn[offset - 1] == '.') &&
- (fqdn.compare(offset, std::string::npos, domain_name) == 0)) {
+ (boost::iequals(fqdn.substr(offset), domain_name))) {
// Fqdn contains domain name, keep it if its better than
// any we have matched so far.
if (dom_len > match_len) {
diff --git a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc
index 645bbae..b0e28f8 100644
--- a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc
+++ b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc
@@ -1066,6 +1066,10 @@ TEST_F(D2CfgMgrTest, forwardMatch) {
EXPECT_TRUE(cfg_mgr_->matchForward("tmark.org", match));
EXPECT_EQ("tmark.org", match->getName());
+ // Verify that search is case insensisitive.
+ EXPECT_TRUE(cfg_mgr_->matchForward("TMARK.ORG", match));
+ EXPECT_EQ("tmark.org", match->getName());
+
// Verify that an exact match works.
EXPECT_TRUE(cfg_mgr_->matchForward("one.tmark.org", match));
EXPECT_EQ("one.tmark.org", match->getName());
@@ -1207,7 +1211,8 @@ TEST_F(D2CfgMgrTest, matchReverse) {
" \"dns_servers\" : [ "
" { \"ip_address\": \"127.0.0.1\" } "
" ] }, "
- "{ \"name\": \"2.0.3.0.8.B.D.0.1.0.0.2.ip6.arpa.\" , "
+ // Note mixed case to test case insensitivity.
+ "{ \"name\": \"2.0.3.0.8.b.d.0.1.0.0.2.IP6.ARPA.\" , "
" \"dns_servers\" : [ "
" { \"ip_address\": \"127.0.0.1\" } "
" ] },"
@@ -1247,7 +1252,7 @@ TEST_F(D2CfgMgrTest, matchReverse) {
// Verify a IPv6 match.
EXPECT_TRUE(cfg_mgr_->matchReverse("2001:db8:302:99::",match));
- EXPECT_EQ("2.0.3.0.8.B.D.0.1.0.0.2.ip6.arpa.", match->getName());
+ EXPECT_EQ("2.0.3.0.8.b.d.0.1.0.0.2.IP6.ARPA.", match->getName());
// Verify a IPv6 wild card match.
EXPECT_TRUE(cfg_mgr_->matchReverse("2001:db8:99:302::",match));
More information about the bind10-changes
mailing list