Commit 4f2cfbfa authored by Marcin Siodelski's avatar Marcin Siodelski

[3059] Removed the C-string from the DdnsDomainListMgr::matchDomain.

parent 40b95610
...@@ -103,7 +103,6 @@ DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) { ...@@ -103,7 +103,6 @@ DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) {
// Iterate over the domain map looking for the domain which matches // Iterate over the domain map looking for the domain which matches
// the longest portion of the given fqdn. // the longest portion of the given fqdn.
const char* req_name = fqdn.c_str();
size_t req_len = fqdn.size(); size_t req_len = fqdn.size();
size_t match_len = 0; size_t match_len = 0;
DdnsDomainMapPair map_pair; DdnsDomainMapPair map_pair;
...@@ -118,7 +117,7 @@ DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) { ...@@ -118,7 +117,7 @@ DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) {
// If the lengths are identical and the names match we're done. // If the lengths are identical and the names match we're done.
if (req_len == dom_len) { if (req_len == dom_len) {
if (req_name == domain_name) { if (fqdn == domain_name) {
// exact match, done // exact match, done
domain = map_pair.second; domain = map_pair.second;
return (true); return (true);
...@@ -129,7 +128,7 @@ DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) { ...@@ -129,7 +128,7 @@ DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) {
// comparison if the adjustment lands on a boundary. This // comparison if the adjustment lands on a boundary. This
// prevents "onetwo.net" from matching "two.net". // prevents "onetwo.net" from matching "two.net".
size_t offset = req_len - dom_len; size_t offset = req_len - dom_len;
if ((req_name[offset - 1] == '.') && if ((fqdn[offset - 1] == '.') &&
(fqdn.compare(offset, std::string::npos, domain_name) == 0)) { (fqdn.compare(offset, std::string::npos, domain_name) == 0)) {
// Fqdn contains domain name, keep it if its better than // Fqdn contains domain name, keep it if its better than
// any we have matched so far. // any we have matched so far.
......
Markdown is supported
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