diff options
author | ShadowNinja <shadowninja@minetest.net> | 2014-09-05 20:08:51 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2015-05-16 18:32:31 -0400 |
commit | 3a8c7888807e4483bbdb3edd81c9893f3e2f427d (patch) | |
tree | 81f339e5f61b03e8d7842e06f034d09bf59dba96 /src/script/lua_api/l_util.cpp | |
parent | f26421228bbd31f02bf16b45a4b82be84f233e52 (diff) | |
download | minetest-3a8c7888807e4483bbdb3edd81c9893f3e2f427d.tar.gz minetest-3a8c7888807e4483bbdb3edd81c9893f3e2f427d.tar.bz2 minetest-3a8c7888807e4483bbdb3edd81c9893f3e2f427d.zip |
Add mod security
Due to compatibility concerns, this is temporarily disabled.
Diffstat (limited to 'src/script/lua_api/l_util.cpp')
-rw-r--r-- | src/script/lua_api/l_util.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index 283cca01f..151d449d5 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -92,12 +92,19 @@ int ModApiUtil::l_log(lua_State *L) return 0; } +#define CHECK_SECURE_SETTING(L, name) \ + if (name.compare(0, 7, "secure.") == 0) {\ + lua_pushliteral(L, "Attempt to set secure setting.");\ + lua_error(L);\ + } + // setting_set(name, value) int ModApiUtil::l_setting_set(lua_State *L) { NO_MAP_LOCK_REQUIRED; - const char *name = luaL_checkstring(L, 1); - const char *value = luaL_checkstring(L, 2); + std::string name = luaL_checkstring(L, 1); + std::string value = luaL_checkstring(L, 2); + CHECK_SECURE_SETTING(L, name); g_settings->set(name, value); return 0; } @@ -120,8 +127,9 @@ int ModApiUtil::l_setting_get(lua_State *L) int ModApiUtil::l_setting_setbool(lua_State *L) { NO_MAP_LOCK_REQUIRED; - const char *name = luaL_checkstring(L, 1); + std::string name = luaL_checkstring(L, 1); bool value = lua_toboolean(L, 2); + CHECK_SECURE_SETTING(L, name); g_settings->setBool(name, value); return 0; } |