From: Kees Monshouwer Date: Sat, 6 Jul 2019 20:58:41 +0000 (+0200) Subject: auth: prevent the chopOff() loop in lookup(), for SOA queries X-Git-Tag: dnsdist-1.4.0-rc3~12^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6678e5ac11362caedebfdb0e9049c94f4a248a1a;p=pdns auth: prevent the chopOff() loop in lookup(), for SOA queries without an id, in bind and lmdb backend. --- diff --git a/modules/bindbackend/bindbackend2.cc b/modules/bindbackend/bindbackend2.cc index a213b2184..859a8028d 100644 --- a/modules/bindbackend/bindbackend2.cc +++ b/modules/bindbackend/bindbackend2.cc @@ -1066,7 +1066,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) diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index 36a533e80..57ce194d5 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -547,17 +547,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<getROTransaction().get(zoneId, di)) { // cout<<"Could not find a zone with id "<