lua: sandbox: remove all traces of the minimal_std flag, as it's no longer used

This commit is contained in:
George Kiagiadakis
2022-04-06 20:25:05 +03:00
parent b216594497
commit 81af8c2069
5 changed files with 3 additions and 8 deletions

View File

@@ -133,7 +133,7 @@ wp_lua_scripting_load_configuration (const gchar * conf_file,
g_auto (GValue) fold_ret = G_VALUE_INIT; g_auto (GValue) fold_ret = G_VALUE_INIT;
gint nfiles = 0; gint nfiles = 0;
wplua_enable_sandbox (L, WP_LUA_SANDBOX_MINIMAL_STD); wplua_enable_sandbox (L, 0);
/* load conf_file itself */ /* load conf_file itself */
path = wp_find_file (CONFIG_DIRS_LOOKUP_SET, conf_file, NULL); path = wp_find_file (CONFIG_DIRS_LOOKUP_SET, conf_file, NULL);

View File

@@ -143,7 +143,6 @@ script_finish_activation_with_error (lua_State * L)
luaL_checktype (L, 1, LUA_TTABLE); luaL_checktype (L, 1, LUA_TTABLE);
msg = luaL_checkstring (L, 2); msg = luaL_checkstring (L, 2);
lua_getglobal (L, "Script");
lua_pushliteral (L, "__transition"); lua_pushliteral (L, "__transition");
lua_gettable (L, 1); lua_gettable (L, 1);
if (lua_type (L, -1) == LUA_TLIGHTUSERDATA) if (lua_type (L, -1) == LUA_TLIGHTUSERDATA)

View File

@@ -148,9 +148,6 @@ wplua_enable_sandbox (lua_State * L, WpLuaSandboxFlags flags)
} }
lua_newtable (L); lua_newtable (L);
lua_pushliteral (L, "minimal_std");
lua_pushboolean (L, (flags & WP_LUA_SANDBOX_MINIMAL_STD));
lua_settable (L, -3);
lua_pushliteral (L, "isolate_env"); lua_pushliteral (L, "isolate_env");
lua_pushboolean (L, (flags & WP_LUA_SANDBOX_ISOLATE_ENV)); lua_pushboolean (L, (flags & WP_LUA_SANDBOX_ISOLATE_ENV));
lua_settable (L, -3); lua_settable (L, -3);

View File

@@ -44,8 +44,7 @@ typedef enum {
} WpLuaError; } WpLuaError;
typedef enum { typedef enum {
WP_LUA_SANDBOX_MINIMAL_STD, WP_LUA_SANDBOX_ISOLATE_ENV = 1,
WP_LUA_SANDBOX_ISOLATE_ENV,
} WpLuaSandboxFlags; } WpLuaSandboxFlags;
lua_State * wplua_new (void); lua_State * wplua_new (void);

View File

@@ -490,7 +490,7 @@ test_wplua_sandbox_config ()
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
lua_State *L = wplua_new (); lua_State *L = wplua_new ();
wplua_enable_sandbox (L, WP_LUA_SANDBOX_MINIMAL_STD); wplua_enable_sandbox (L, 0);
const gchar code3[] = const gchar code3[] =
"o = { answer = 42 }\n"; "o = { answer = 42 }\n";