Skip to content

Commit

Permalink
Merge pull request #4590 from rgacogne/auth-34-lower-notify
Browse files Browse the repository at this point in the history
auth: Lowercase the qname in getDomainInfo() and isMaster()
  • Loading branch information
pieterlexis committed Oct 24, 2016
2 parents b14c7d8 + b4c5d8f commit 118fc10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions modules/bindbackend/bindbackend2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,12 @@ void Bind2Backend::getUnfreshSlaveInfos(vector<DomainInfo> *unfreshDomains)
bool Bind2Backend::getDomainInfo(const string &domain, DomainInfo &di)
{
BB2DomainInfo bbd;
if(!safeGetBBDomainInfo(domain, &bbd))
string domainLC(toLower(domain));
if(!safeGetBBDomainInfo(domainLC, &bbd))
return false;

di.id=bbd.d_id;
di.zone=domain;
di.zone=domainLC;
di.masters=bbd.d_masters;
di.last_check=bbd.d_lastcheck;
di.backend=this;
Expand Down Expand Up @@ -1225,7 +1226,7 @@ bool Bind2Backend::handle::get_list(DNSResourceRecord &r)
bool Bind2Backend::isMaster(const string &name, const string &ip)
{
BB2DomainInfo bbd;
if(!safeGetBBDomainInfo(name, &bbd))
if(!safeGetBBDomainInfo(toLower(name), &bbd))
return false;

for(vector<string>::const_iterator iter = bbd.d_masters.begin(); iter != bbd.d_masters.end(); ++iter)
Expand Down
4 changes: 2 additions & 2 deletions pdns/backends/gsql/gsqlbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void GSQLBackend::setFresh(uint32_t domain_id)

bool GSQLBackend::isMaster(const string &domain, const string &ip)
{
string query = (GSQLformat(d_MasterOfDomainsZoneQuery) % sqlEscape(domain)).str();
string query = (GSQLformat(d_MasterOfDomainsZoneQuery) % sqlEscape(toLower(domain))).str();

try {
d_db->doQuery(query, d_result);
Expand Down Expand Up @@ -146,7 +146,7 @@ bool GSQLBackend::getDomainInfo(const string &domain, DomainInfo &di)
id,name,master IP(s),last_check,notified_serial,type,account */
char output[1024];
snprintf(output,sizeof(output)-1,d_InfoOfDomainsZoneQuery.c_str(),
sqlEscape(domain).c_str());
sqlEscape(toLower(domain)).c_str());
try {
d_db->doQuery(output,d_result);
}
Expand Down

0 comments on commit 118fc10

Please sign in to comment.