From: Kees Monshouwer Date: Tue, 6 Sep 2022 13:52:51 +0000 (+0200) Subject: auth: initialize zone cache after dropping privileges X-Git-Tag: rec-4.8.0-alpha1~32^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11908%2Fhead;p=thirdparty%2Fpdns.git auth: initialize zone cache after dropping privileges --- diff --git a/pdns/auth-main.cc b/pdns/auth-main.cc index 96f20a4dfd..4c985d78c2 100644 --- a/pdns/auth-main.cc +++ b/pdns/auth-main.cc @@ -816,6 +816,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(); @@ -1418,14 +1435,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(); // this fails when we are not root, throws exception g_udpReceivers.push_back(N);