From: Fred Morcos Date: Thu, 26 Oct 2023 12:50:20 +0000 (+0200) Subject: Refactor UeberBackend::getAuth: foundTarget X-Git-Tag: rec-5.0.0-beta1~16^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d4a47dcc9c4dc70caeadf7e6ac12d3dde63735c;p=thirdparty%2Fpdns.git Refactor UeberBackend::getAuth: foundTarget --- diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index 58dda6cf68..17d8178613 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -433,6 +433,19 @@ static std::vector::iterator findBestMatchingBackend(std::vectorqname; + + if (found == (qtype == QType::DS) || target != shorter) { + DLOG(g_log << Logger::Error << "found: " << name << endl); + return true; + } + + DLOG(g_log << Logger::Error << "chasing next: " << name << endl); + return false; +} + bool UeberBackend::getAuth(const DNSName& target, const QType& qtype, SOAData* soaData, bool cachedOk) { // A backend can respond to our authority request with the 'best' match it @@ -511,14 +524,11 @@ bool UeberBackend::getAuth(const DNSName& target, const QType& qtype, SOAData* s } found: - if (found == (qtype == QType::DS) || target != shorter) { - DLOG(g_log << Logger::Error << "found: " << soaData->qname << endl); + if (foundTarget(target, shorter, qtype, soaData, found)) { return true; } - else { - DLOG(g_log << Logger::Error << "chasing next: " << soaData->qname << endl); - found = true; - } + + found = true; } while (shorter.chopOff()); return found;