Skip to content

Commit ac3ae09

Browse files
author
Peter van Dijk
committed
Merge pull request #2445 from mind04/3.4.4
make makeRelative() case insensitive
2 parents c21d2d1 + 091e359 commit ac3ae09

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

pdns/backends/gsql/gsqlbackend.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ bool GSQLBackend::updateDNSSECOrderAndAuthAbsolute(uint32_t domain_id, const std
372372
return false;
373373
char output[1024];
374374

375-
snprintf(output, sizeof(output)-1, d_setOrderAuthQuery.c_str(), sqlEscape(ordername).c_str(), auth, sqlEscape(qname).c_str(), domain_id);
375+
snprintf(output, sizeof(output)-1, d_setOrderAuthQuery.c_str(), sqlEscape(ordername).c_str(), auth, sqlEscape(toLower(qname)).c_str(), domain_id);
376376
try {
377377
d_db->doCommand(output);
378378
}
@@ -388,7 +388,7 @@ bool GSQLBackend::nullifyDNSSECOrderNameAndUpdateAuth(uint32_t domain_id, const
388388
return false;
389389
char output[1024];
390390

391-
snprintf(output, sizeof(output)-1, d_nullifyOrderNameAndUpdateAuthQuery.c_str(), auth, domain_id, sqlEscape(qname).c_str());
391+
snprintf(output, sizeof(output)-1, d_nullifyOrderNameAndUpdateAuthQuery.c_str(), auth, domain_id, sqlEscape(toLower(qname)).c_str());
392392
try {
393393
d_db->doCommand(output);
394394
}
@@ -404,7 +404,7 @@ bool GSQLBackend::nullifyDNSSECOrderNameAndAuth(uint32_t domain_id, const std::s
404404
return false;
405405
char output[1024];
406406

407-
snprintf(output, sizeof(output)-1, d_nullifyOrderNameAndAuthQuery.c_str(), sqlEscape(qname).c_str(), sqlEscape(type).c_str(), domain_id);
407+
snprintf(output, sizeof(output)-1, d_nullifyOrderNameAndAuthQuery.c_str(), sqlEscape(toLower(qname)).c_str(), sqlEscape(type).c_str(), domain_id);
408408
try {
409409
d_db->doCommand(output);
410410
}

pdns/misc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ string makeRelative(const std::string& fqdn, const std::string& zone)
654654
{
655655
if(zone.empty())
656656
return fqdn;
657-
if(fqdn != zone)
657+
if(toLower(fqdn) != toLower(zone))
658658
return fqdn.substr(0, fqdn.size() - zone.length() - 1); // strip domain name
659659
return "";
660660
}

pdns/test-misc_hh.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ BOOST_AUTO_TEST_CASE(test_labelReverse) {
110110

111111
BOOST_AUTO_TEST_CASE(test_makeRelative) {
112112
BOOST_CHECK_EQUAL(makeRelative("www.powerdns.com", "powerdns.com"), "www");
113+
BOOST_CHECK_EQUAL(makeRelative("PoWeRdNs.CoM", "powerdns.com"), "");
113114
}
114115

115116
BOOST_AUTO_TEST_CASE(test_AtomicCounter) {

0 commit comments

Comments
 (0)