]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth-4.6.x: initialize zone cache after dropping privileges
authorKees Monshouwer <mind04@monshouwer.org>
Mon, 12 Sep 2022 11:32:50 +0000 (13:32 +0200)
committermind04 <mind04@monshouwer.org>
Fri, 14 Oct 2022 08:58:21 +0000 (10:58 +0200)
pdns/common_startup.cc
pdns/receiver.cc

index 041925e44131208f78fbb47bf1c3b7f30c97d151..7ce92849c1deff58304d4aefdec1618a9f0c49da 100644 (file)
@@ -753,6 +753,23 @@ void mainthread()
 
   pdns::parseTrustedNotificationProxy(::arg()["trusted-notification-proxy"]);
 
+  UeberBackend::go();
+
+  // Setup the zone cache
+  g_zoneCache.setRefreshInterval(::arg().asNum("zone-cache-refresh-interval"));
+  try {
+    UeberBackend B;
+    B.updateZoneCache();
+  }
+  catch (PDNSException& e) {
+    g_log << Logger::Error << "PDNSException while filling the zone cache: " << e.reason << endl;
+    exit(1);
+  }
+  catch (std::exception& e) {
+    g_log << Logger::Error << "STL Exception while filling the zone cache: " << e.what() << endl;
+    exit(1);
+  }
+
   // NOW SAFE TO CREATE THREADS!
   dl->go();
 
index e5e67854d31e200bb29132ae23053f6034377c36..e02fd2ea805c0bdcb4a0b16d79421b5d07e665ad 100644 (file)
@@ -627,14 +627,6 @@ int main(int argc, char **argv)
       }
     }
 
-    UeberBackend::go();
-
-    g_zoneCache.setRefreshInterval(::arg().asNum("zone-cache-refresh-interval"));
-    {
-      UeberBackend B;
-      B.updateZoneCache();
-    }
-
     N=std::make_shared<UDPNameserver>(); // this fails when we are not root, throws exception
     g_udpReceivers.push_back(N);