]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth API: add zone to zonecache in flush endpoint 11066/head
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Fri, 3 Dec 2021 12:52:38 +0000 (13:52 +0100)
committerChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Fri, 3 Dec 2021 13:20:31 +0000 (14:20 +0100)
pdns/ws-auth.cc

index 5172ac8d69d24b9ac0b575fe6bf490cd0d847d2e..03ed5c3f1320711be14b8ee86f3fefa031f2fe46 100644 (file)
@@ -2270,6 +2270,16 @@ static void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp) {
 
   DNSName canon = apiNameToDNSName(req->getvars["domain"]);
 
+  if (g_zoneCache.isEnabled()) {
+    DomainInfo di;
+    UeberBackend B;
+    if (B.getDomainInfo(canon, di, false)) {
+      // zone exists (uncached), add/update it in the zone cache.
+      // Handle this first, to avoid concurrent queries re-populating the other caches.
+      g_zoneCache.add(di.zone, di.id);
+    }
+  }
+
   // purge entire zone from cache, not just zone-level records.
   uint64_t count = purgeAuthCaches(canon.toString() + "$");
   resp->setJsonBody(Json::object {