From: Remi Gacogne Date: Mon, 17 Nov 2025 15:57:41 +0000 (+0100) Subject: rec: Handle more cases where the authority records might not be empty X-Git-Tag: rec-5.4.0-alpha1~19^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8da1d067cd09a99f1ecdb6967ca3dcb27c434d14;p=thirdparty%2Fpdns.git rec: Handle more cases where the authority records might not be empty Signed-off-by: Remi Gacogne --- diff --git a/pdns/recursordist/recursor_cache.cc b/pdns/recursordist/recursor_cache.cc index 88464ae4e8..a946ffda61 100644 --- a/pdns/recursordist/recursor_cache.cc +++ b/pdns/recursordist/recursor_cache.cc @@ -464,6 +464,10 @@ time_t MemRecursorCache::get(time_t now, const DNSName& qname, const QType qtype } auto entryAAAA = getEntryUsingECSIndex(*lockedShard, now, qname, QType::AAAA, requireAuth, who, serveStale); if (entryAAAA != lockedShard->d_map.end()) { + if (authorityRecs != nullptr) { + // For the case the loop iterates multiple times + *authorityRecs = s_emptyAuthRecs; + } time_t ttdAAAA = handleHit(now, *lockedShard, entryAAAA, qname, origTTL, res, signatures, authorityRecs, variable, cachedState, wasAuth, fromAuthZone, extra); if (ret > 0) { ret = std::min(ret, ttdAAAA); @@ -513,6 +517,11 @@ time_t MemRecursorCache::get(time_t now, const DNSName& qname, const QType qtype handleServeStaleBookkeeping(now, serveStale, firstIndexIterator); + if (authorityRecs != nullptr) { + // For the case the loop iterates multiple times + *authorityRecs = s_emptyAuthRecs; + } + ttd = handleHit(now, *lockedShard, firstIndexIterator, qname, origTTL, res, signatures, authorityRecs, variable, cachedState, wasAuth, fromAuthZone, extra); if (qtype == QType::ADDR && found == 2) {