]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist setTicketsKeyAddedHook: pass a std::string to the hook to avoid luawrapper... 14768/head
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Sat, 12 Oct 2024 19:10:36 +0000 (21:10 +0200)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Sat, 12 Oct 2024 19:10:36 +0000 (21:10 +0200)
pdns/dnsdistdist/dnsdist-lua-hooks.cc

index 2904cd37926a07351de3cdef8468c9f308916660..8bdff2e17ce782f246324fb31def8e2d2fbea51a 100644 (file)
@@ -7,7 +7,7 @@
 namespace dnsdist::lua::hooks
 {
 using MaintenanceCallback = std::function<void()>;
-using TicketsKeyAddedHook = std::function<void(const char*, size_t)>;
+using TicketsKeyAddedHook = std::function<void(const std::string&, size_t)>;
 
 static LockGuarded<std::vector<MaintenanceCallback>> s_maintenanceHooks;
 
@@ -35,7 +35,7 @@ static void setTicketsKeyAddedHook(const LuaContext& context, const TicketsKeyAd
   TLSCtx::setTicketsKeyAddedHook([hook](const std::string& key) {
     try {
       auto lua = g_lua.lock();
-      hook(key.c_str(), key.size());
+      hook(key, key.size());
     }
     catch (const std::exception& exp) {
       warnlog("Error calling the Lua hook after new tickets key has been added: %s", exp.what());