]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Add a return value when generating and loading a DNSCrypt certificate
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 24 Apr 2025 13:03:18 +0000 (15:03 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 25 Apr 2025 12:19:33 +0000 (14:19 +0200)
pdns/dnsdistdist/dnsdist-lua-bindings-dnscrypt.cc

index 5d5573aae0857fa0a242220b79aacd5e58d1b1c5..c2a6aa71a47d64a8f4f0fa404efb0b081139af36 100644 (file)
@@ -108,7 +108,7 @@ void setupLuaBindingsDNSCrypt([[maybe_unused]] LuaContext& luaCtx, [[maybe_unuse
     return ret.str();
   });
 
-  luaCtx.registerFunction<void (DNSCryptContext::*)(const std::string& providerPrivateKeyFile, uint32_t serial, time_t begin, time_t end, boost::optional<DNSCryptExchangeVersion> version)>("generateAndLoadInMemoryCertificate", [](DNSCryptContext& ctx, const std::string& providerPrivateKeyFile, uint32_t serial, time_t begin, time_t end, boost::optional<DNSCryptExchangeVersion> version) {
+  luaCtx.registerFunction<bool (DNSCryptContext::*)(const std::string& providerPrivateKeyFile, uint32_t serial, time_t begin, time_t end, boost::optional<DNSCryptExchangeVersion> version)>("generateAndLoadInMemoryCertificate", [](DNSCryptContext& ctx, const std::string& providerPrivateKeyFile, uint32_t serial, time_t begin, time_t end, boost::optional<DNSCryptExchangeVersion> version) -> bool {
     DNSCryptPrivateKey privateKey;
     DNSCryptCert cert;
 
@@ -120,7 +120,9 @@ void setupLuaBindingsDNSCrypt([[maybe_unused]] LuaContext& luaCtx, [[maybe_unuse
     catch (const std::exception& e) {
       errlog("Error generating a DNSCrypt certificate: %s", e.what());
       g_outputBuffer = "Error generating a DNSCrypt certificate: " + string(e.what()) + "\n";
+      return false;
     }
+    return true;
   });
 
   /* DNSCryptCertificatePair */