]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Handle more cases where the authority records might not be empty
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 17 Nov 2025 15:57:41 +0000 (16:57 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 8 Dec 2025 08:20:18 +0000 (09:20 +0100)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/recursordist/recursor_cache.cc

index 88464ae4e8a0da31558a9003723b5d280d38c0d1..a946ffda61dd5b96525cd37badb105ae3a76591c 100644 (file)
@@ -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) {