]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Adapt update policy load to new loadFile semantics, which throws on error. 11143/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 2 Sep 2022 12:33:31 +0000 (14:33 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 2 Sep 2022 12:33:31 +0000 (14:33 +0200)
pdns/packethandler.cc

index f24f7f3988500b3839ac1f937d2055ac4af46905..f15eb3f3696573915616787c22618c633f3444e0 100644 (file)
@@ -78,7 +78,7 @@ PacketHandler::PacketHandler():B(s_programname), d_dk(&B)
   else
   {
     d_pdl = std::make_unique<AuthLua4>();
-    d_pdl->loadFile(fname);
+    d_pdl->loadFile(fname); // XXX exception handling?
   }
   fname = ::arg()["lua-dnsupdate-policy-script"];
   if (fname.empty())
@@ -88,7 +88,10 @@ PacketHandler::PacketHandler():B(s_programname), d_dk(&B)
   else
   {
     d_update_policy_lua = std::make_unique<AuthLua4>();
-    if (d_update_policy_lua->loadFile(fname) != 0) {
+    try {
+      d_update_policy_lua->loadFile(fname);
+    }
+    catch (const std::runtime_error&) {
       d_update_policy_lua = nullptr;
     }
   }