Permalink
Browse files

Merge pull request #2445 from mind04/3.4.4

make makeRelative() case insensitive
  • Loading branch information...
2 parents c21d2d1 + 091e359 commit ac3ae09bd0fa293a800868702a22df26b1a8c227 @Habbie Habbie committed Apr 23, 2015
Showing with 5 additions and 4 deletions.
  1. +3 −3 pdns/backends/gsql/gsqlbackend.cc
  2. +1 −1 pdns/misc.cc
  3. +1 −0 pdns/test-misc_hh.cc
@@ -372,7 +372,7 @@ bool GSQLBackend::updateDNSSECOrderAndAuthAbsolute(uint32_t domain_id, const std
return false;
char output[1024];
- snprintf(output, sizeof(output)-1, d_setOrderAuthQuery.c_str(), sqlEscape(ordername).c_str(), auth, sqlEscape(qname).c_str(), domain_id);
+ snprintf(output, sizeof(output)-1, d_setOrderAuthQuery.c_str(), sqlEscape(ordername).c_str(), auth, sqlEscape(toLower(qname)).c_str(), domain_id);
try {
d_db->doCommand(output);
}
@@ -388,7 +388,7 @@ bool GSQLBackend::nullifyDNSSECOrderNameAndUpdateAuth(uint32_t domain_id, const
return false;
char output[1024];
- snprintf(output, sizeof(output)-1, d_nullifyOrderNameAndUpdateAuthQuery.c_str(), auth, domain_id, sqlEscape(qname).c_str());
+ snprintf(output, sizeof(output)-1, d_nullifyOrderNameAndUpdateAuthQuery.c_str(), auth, domain_id, sqlEscape(toLower(qname)).c_str());
try {
d_db->doCommand(output);
}
@@ -404,7 +404,7 @@ bool GSQLBackend::nullifyDNSSECOrderNameAndAuth(uint32_t domain_id, const std::s
return false;
char output[1024];
- snprintf(output, sizeof(output)-1, d_nullifyOrderNameAndAuthQuery.c_str(), sqlEscape(qname).c_str(), sqlEscape(type).c_str(), domain_id);
+ snprintf(output, sizeof(output)-1, d_nullifyOrderNameAndAuthQuery.c_str(), sqlEscape(toLower(qname)).c_str(), sqlEscape(type).c_str(), domain_id);
try {
d_db->doCommand(output);
}
View
@@ -654,7 +654,7 @@ string makeRelative(const std::string& fqdn, const std::string& zone)
{
if(zone.empty())
return fqdn;
- if(fqdn != zone)
+ if(toLower(fqdn) != toLower(zone))
return fqdn.substr(0, fqdn.size() - zone.length() - 1); // strip domain name
return "";
}
@@ -110,6 +110,7 @@ BOOST_AUTO_TEST_CASE(test_labelReverse) {
BOOST_AUTO_TEST_CASE(test_makeRelative) {
BOOST_CHECK_EQUAL(makeRelative("www.powerdns.com", "powerdns.com"), "www");
+ BOOST_CHECK_EQUAL(makeRelative("PoWeRdNs.CoM", "powerdns.com"), "");
}
BOOST_AUTO_TEST_CASE(test_AtomicCounter) {

0 comments on commit ac3ae09

Please sign in to comment.