From: Remi Gacogne Date: Fri, 12 Nov 2021 15:06:17 +0000 (+0100) Subject: dnsdist: Remove deprecated actions X-Git-Tag: auth-4.7.0-alpha1~103^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e22209274a48fde28ab7cb256939ee65e5283bfa;p=thirdparty%2Fpdns.git dnsdist: Remove deprecated actions --- diff --git a/pdns/dnsdist-lua-actions.cc b/pdns/dnsdist-lua-actions.cc index 2221d57cbc..c0b184c2d4 100644 --- a/pdns/dnsdist-lua-actions.cc +++ b/pdns/dnsdist-lua-actions.cc @@ -2129,11 +2129,6 @@ void setupLuaActions(LuaContext& luaCtx) return std::shared_ptr(new SetNoRecurseAction); }); - luaCtx.writeFunction("NoRecurseAction", []() { - warnlog("access to NoRecurseAction is deprecated and will be removed in a future version, please use SetNoRecurseAction instead"); - return std::shared_ptr(new SetNoRecurseAction); - }); - luaCtx.writeFunction("SetMacAddrAction", [](int code) { return std::shared_ptr(new SetMacAddrAction(code)); }); @@ -2142,11 +2137,6 @@ void setupLuaActions(LuaContext& luaCtx) return std::shared_ptr(new SetEDNSOptionAction(code, data)); }); - luaCtx.writeFunction("MacAddrAction", [](int code) { - warnlog("access to MacAddrAction is deprecated and will be removed in a future version, please use SetMacAddrAction instead"); - return std::shared_ptr(new SetMacAddrAction(code)); - }); - luaCtx.writeFunction("PoolAction", [](const std::string& a) { return std::shared_ptr(new PoolAction(a)); }); @@ -2239,11 +2229,6 @@ void setupLuaActions(LuaContext& luaCtx) return std::shared_ptr(new SetDisableValidationAction); }); - luaCtx.writeFunction("DisableValidationAction", []() { - warnlog("access to DisableValidationAction is deprecated and will be removed in a future version, please use SetDisableValidationAction instead"); - return std::shared_ptr(new SetDisableValidationAction); - }); - luaCtx.writeFunction("LogAction", [](boost::optional fname, boost::optional binary, boost::optional append, boost::optional buffered, boost::optional verboseOnly, boost::optional includeTimestamp) { return std::shared_ptr(new LogAction(fname ? *fname : "", binary ? *binary : true, append ? *append : false, buffered ? *buffered : false, verboseOnly ? *verboseOnly : true, includeTimestamp ? *includeTimestamp : false)); }); @@ -2295,11 +2280,6 @@ void setupLuaActions(LuaContext& luaCtx) return std::shared_ptr(new SetSkipCacheAction); }); - luaCtx.writeFunction("SkipCacheAction", []() { - warnlog("access to SkipCacheAction is deprecated and will be removed in a future version, please use SetSkipCacheAction instead"); - return std::shared_ptr(new SetSkipCacheAction); - }); - luaCtx.writeFunction("SetSkipCacheResponseAction", []() { return std::shared_ptr(new SetSkipCacheResponseAction); }); @@ -2308,11 +2288,6 @@ void setupLuaActions(LuaContext& luaCtx) return std::shared_ptr(new SetTempFailureCacheTTLAction(maxTTL)); }); - luaCtx.writeFunction("TempFailureCacheTTLAction", [](int maxTTL) { - warnlog("access to TempFailureCacheTTLAction is deprecated and will be removed in a future version, please use SetTempFailureCacheTTLAction instead"); - return std::shared_ptr(new SetTempFailureCacheTTLAction(maxTTL)); - }); - luaCtx.writeFunction("DropResponseAction", []() { return std::shared_ptr(new DropResponseAction); }); @@ -2406,29 +2381,14 @@ void setupLuaActions(LuaContext& luaCtx) return std::shared_ptr(new SetECSPrefixLengthAction(v4PrefixLength, v6PrefixLength)); }); - luaCtx.writeFunction("ECSPrefixLengthAction", [](uint16_t v4PrefixLength, uint16_t v6PrefixLength) { - warnlog("access to ECSPrefixLengthAction is deprecated and will be removed in a future version, please use SetECSPrefixLengthAction instead"); - return std::shared_ptr(new SetECSPrefixLengthAction(v4PrefixLength, v6PrefixLength)); - }); - luaCtx.writeFunction("SetECSOverrideAction", [](bool ecsOverride) { return std::shared_ptr(new SetECSOverrideAction(ecsOverride)); }); - luaCtx.writeFunction("ECSOverrideAction", [](bool ecsOverride) { - warnlog("access to ECSOverrideAction is deprecated and will be removed in a future version, please use SetECSOverrideAction instead"); - return std::shared_ptr(new SetECSOverrideAction(ecsOverride)); - }); - luaCtx.writeFunction("SetDisableECSAction", []() { return std::shared_ptr(new SetDisableECSAction()); }); - luaCtx.writeFunction("DisableECSAction", []() { - warnlog("access to DisableECSAction is deprecated and will be removed in a future version, please use SetDisableECSAction instead"); - return std::shared_ptr(new SetDisableECSAction()); - }); - luaCtx.writeFunction("SetECSAction", [](const std::string v4, boost::optional v6) { if (v6) { return std::shared_ptr(new SetECSAction(Netmask(v4), Netmask(*v6))); @@ -2456,20 +2416,10 @@ void setupLuaActions(LuaContext& luaCtx) return std::shared_ptr(new SetTagAction(tag, value)); }); - luaCtx.writeFunction("TagAction", [](std::string tag, std::string value) { - warnlog("access to TagAction is deprecated and will be removed in a future version, please use SetTagAction instead"); - return std::shared_ptr(new SetTagAction(tag, value)); - }); - luaCtx.writeFunction("SetTagResponseAction", [](std::string tag, std::string value) { return std::shared_ptr(new SetTagResponseAction(tag, value)); }); - luaCtx.writeFunction("TagResponseAction", [](std::string tag, std::string value) { - warnlog("access to TagResponseAction is deprecated and will be removed in a future version, please use SetTagResponseAction instead"); - return std::shared_ptr(new SetTagResponseAction(tag, value)); - }); - luaCtx.writeFunction("ContinueAction", [](std::shared_ptr action) { return std::shared_ptr(new ContinueAction(action)); }); @@ -2498,14 +2448,6 @@ void setupLuaActions(LuaContext& luaCtx) return ret; }); - luaCtx.writeFunction("SetNegativeAndSOAAction", [](bool nxd, const std::string& zone, uint32_t ttl, const std::string& mname, const std::string& rname, uint32_t serial, uint32_t refresh, uint32_t retry, uint32_t expire, uint32_t minimum, boost::optional vars) { - warnlog("access to SetNegativeAndSOAAction is deprecated and will be removed in a future version, please use NegativeAndSOAAction instead"); - auto ret = std::shared_ptr(new NegativeAndSOAAction(nxd, DNSName(zone), ttl, DNSName(mname), DNSName(rname), serial, refresh, retry, expire, minimum)); - auto action = std::dynamic_pointer_cast(ret); - parseResponseConfig(vars, action->d_responseConfig); - return ret; - }); - luaCtx.writeFunction("SetProxyProtocolValuesAction", [](const std::vector>& values) { return std::shared_ptr(new SetProxyProtocolValuesAction(values)); }); diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index f456822168..69dc8efc43 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -954,7 +954,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) }); #endif /* DISABLE_CARBON */ - luaCtx.writeFunction("webserver", [client, configCheck](const std::string& address, boost::optional password, boost::optional apiKey, const boost::optional> customHeaders, const boost::optional acl) { + luaCtx.writeFunction("webserver", [client, configCheck](const std::string& address) { setLuaSideEffect(); ComboAddress local; try { @@ -968,37 +968,12 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) return; } - if (password || apiKey || customHeaders || acl) { - warnlog("Passing additional parameters to 'webserver()' is deprecated, please use 'setWebserverConfig()' instead."); - } - try { int sock = SSocket(local.sin4.sin_family, SOCK_STREAM, 0); SSetsockopt(sock, SOL_SOCKET, SO_REUSEADDR, 1); SBind(sock, local); SListen(sock, 5); - auto launch = [sock, local, password, apiKey, customHeaders, acl]() { - if (password) { - auto holder = make_unique(std::string(*password), false); - if (!holder->wasHashed() && holder->isHashingAvailable()) { - infolog("Passing a plain-text password to 'webserver()' is deprecated, please use 'setWebserverConfig()' instead and consider generating a hashed password using 'hashPassword()'."); - } - - setWebserverPassword(std::move(holder)); - } - - if (apiKey) { - auto holder = make_unique(std::string(*apiKey), false); - setWebserverAPIKey(std::move(holder)); - } - - if (customHeaders) { - setWebserverCustomHeaders(customHeaders); - } - - if (acl) { - setWebserverACL(*acl); - } + auto launch = [sock, local]() { thread t(dnsdistWebserverThread, sock, local); t.detach(); };