]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: prevent the chopOff() loop in lookup(), for SOA queries
authorKees Monshouwer <mind04@monshouwer.org>
Sat, 6 Jul 2019 20:58:41 +0000 (22:58 +0200)
committermind04 <mind04@monshouwer.org>
Wed, 17 Jul 2019 16:36:52 +0000 (18:36 +0200)
without an id, in bind and lmdb backend.

modules/bindbackend/bindbackend2.cc
modules/lmdbbackend/lmdbbackend.cc

index cc89bff385971a51ca523f877d2bfc126d2408b6..80507fb58798143caa63e88477c358d25d625acb 100644 (file)
@@ -1055,7 +1055,7 @@ void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
 
   do {
     found = safeGetBBDomainInfo(domain, &bbd);
-  } while ((!found || (zoneId != (int)bbd.d_id && zoneId != -1)) && domain.chopOff());
+  } while ((!found || (zoneId != (int)bbd.d_id && zoneId != -1)) && qtype != QType::SOA && domain.chopOff());
 
   if(!found) {
     if(mustlog)
index e78744a937b0664422da0f29177005c8b497cf9c..9b4c83817c558159042dab473acc34ee1e13681a 100644 (file)
@@ -535,17 +535,13 @@ void LMDBBackend::lookup(const QType &type, const DNSName &qdomain, DNSPacket *p
     d_dtime.set();
   }
   DNSName hunt(qdomain);
+  DomainInfo di;
   if(zoneId < 0) {
     auto rotxn = d_tdomains->getROTransaction();
     
-    for(;;) {
-      DomainInfo di;
-      if((zoneId = rotxn.get<0>(hunt, di))) {
-        break;
-      }
-      if(!hunt.chopOff())
-        break;
-    }
+    do {
+      zoneId = rotxn.get<0>(hunt, di);
+    } while (!zoneId && type != QType::SOA && hunt.chopOff());
     if(zoneId <= 0) {
       //      cout << "Did not find zone for "<< qdomain<<endl;
       d_getcursor.reset();
@@ -553,7 +549,6 @@ void LMDBBackend::lookup(const QType &type, const DNSName &qdomain, DNSPacket *p
     }
   }
   else {
-    DomainInfo di;
     if(!d_tdomains->getROTransaction().get(zoneId, di)) {
       // cout<<"Could not find a zone with id "<<zoneId<<endl;
       d_getcursor.reset();