]> granicus.if.org Git - pdns/commitdiff
auth: improve the handling of duplicate id's in bindbackend
authorKees Monshouwer <mind04@monshouwer.org>
Mon, 15 Jul 2019 08:55:28 +0000 (10:55 +0200)
committermind04 <mind04@monshouwer.org>
Fri, 20 Sep 2019 12:44:10 +0000 (14:44 +0200)
duplicate id's are not allowed in powerdns and will still result in undefined behavior

modules/bindbackend/bindbackend2.cc

index bfd52c1df681f396336a51bf7df1cfc1269f8043..089227154868469ab6f69983c90513f19472da46 100644 (file)
@@ -1067,7 +1067,7 @@ void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, int zoneId,
     g_log<<Logger::Warning<<"Lookup for '"<<qtype.getName()<<"' of '"<<qname<<"' within zoneID "<<zoneId<<endl;
 
   if (zoneId >= 0) {
-    if ((found = safeGetBBDomainInfo(zoneId, &bbd))) {
+    if ((found = (safeGetBBDomainInfo(zoneId, &bbd) && qname.isPartOf(bbd.d_name)))) {
       domain = bbd.d_name;
     }
   } else {
@@ -1079,7 +1079,7 @@ void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, int zoneId,
 
   if(!found) {
     if(mustlog)
-      g_log<<Logger::Warning<<"Found no authoritative zone for "<<qname<<endl;
+      g_log<<Logger::Warning<<"Found no authoritative zone for '"<<qname<<"' and/or id "<<bbd.d_id<<endl;
     d_handle.d_list=false;
     return;
   }
@@ -1088,12 +1088,7 @@ void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, int zoneId,
     g_log<<Logger::Warning<<"Found a zone '"<<domain<<"' (with id " << bbd.d_id<<") that might contain data "<<endl;
 
   d_handle.id=bbd.d_id;
-
-  if(domain.empty())
-    d_handle.qname=qname;
-  else if(qname.isPartOf(domain))
-    d_handle.qname=qname.makeRelative(domain); // strip domain name
-
+  d_handle.qname=qname.makeRelative(domain); // strip domain name
   d_handle.qtype=qtype;
   d_handle.domain=domain;