]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
net-tls: perform struct dependency check, rename to match context
authorFrantisek Tobias <frantisek.tobias@nic.cz>
Fri, 21 Mar 2025 09:02:08 +0000 (10:02 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 7 Jul 2025 14:22:05 +0000 (16:22 +0200)
daemon/bindings/net.c

index 9d2c52c90521cdb94d8e6be5e072a7c7cf444664..e94776e7b26d96129e11f96f72b2fcee45980350 100644 (file)
@@ -531,13 +531,16 @@ static int net_pipeline(lua_State *L)
        return 1;
 }
 
-#include "lib/resolve.h"
 static int net_tls_whitelist(lua_State *L)
 {
-       if (!the_network || !the_network->tls_credentials)
-               return 1;
+       if (kr_fails_assert(the_network)) {
+               return kr_error(EINVAL);
+       }
 
-       int r = kr_init_whitelist(lua_tostring(L, 1));
+       if (lua_gettop(L) != 1 || !lua_isstring(L, 1)) {
+               lua_error_p(L, "net.tls.whitelist takes one parameter: (\"whitelist-file\")");
+       }
+       int r = tls_certificate_authority_whitelist_set(lua_tostring(L, 1));
        lua_error_maybe(L, r);
 
        lua_pushboolean(L, true);