From: Remi Gacogne Date: Tue, 1 Mar 2022 13:36:41 +0000 (+0100) Subject: dnsdist: Do not execute 'newThread' in client and config check modes X-Git-Tag: auth-4.7.0-alpha1~25^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11258%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Do not execute 'newThread' in client and config check modes --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 6820dccaf7..d7c94ddad2 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -2794,7 +2794,10 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) }); #endif /* HAVE_LIBSSL */ - luaCtx.writeFunction("newThread", [](const std::string& code) { + luaCtx.writeFunction("newThread", [client, configCheck](const std::string& code) { + if (client || configCheck) { + return; + } std::thread newThread(LuaThread, code); newThread.detach(); }); diff --git a/pdns/dnsdistdist/docs/reference/config.rst b/pdns/dnsdistdist/docs/reference/config.rst index c74ab9e21b..b7c4b89749 100644 --- a/pdns/dnsdistdist/docs/reference/config.rst +++ b/pdns/dnsdistdist/docs/reference/config.rst @@ -1608,6 +1608,7 @@ Other functions Spawns a separate thread running the supplied code. Code is supplied as a string, not as a function object. + Note that this function does nothing in 'client' or 'config-check' modes. .. function:: submitToMainThread(cmd, dict)