10#define CHECK_SECURE_PATH_INTERNAL(L, path, write_required, ptr) \
11 if (!ScriptApiSecurity::checkPath(L, path, write_required, ptr)) { \
12 throw LuaError(std::string("Mod security: Blocked attempted ") + \
13 (write_required ? "write to " : "read from ") + path); \
15#define CHECK_SECURE_PATH(L, path, write_required) \
16 if (ScriptApiSecurity::isSecure(L)) { \
17 CHECK_SECURE_PATH_INTERNAL(L, path, write_required, NULL); \
19#define CHECK_SECURE_PATH_POSSIBLE_WRITE(L, path, ptr) \
20 if (ScriptApiSecurity::isSecure(L)) { \
21 CHECK_SECURE_PATH_INTERNAL(L, path, false, ptr); \
34 static bool safeLoadString(lua_State *L,
const std::string &code,
const char *chunk_name);
36 static bool safeLoadFile(lua_State *L,
const char *path,
const char *display_name = NULL);
41 static bool checkPath(lua_State *L,
const char *path,
bool write_required,
42 bool *write_allowed=NULL);
Definition s_security.h:26
static int sl_os_remove(lua_State *L)
Definition s_security.cpp:893
static int sl_os_setlocale(lua_State *L)
Definition s_security.cpp:906
void initializeSecurityClient()
Definition s_security.cpp:263
void initializeSecurity()
Definition s_security.cpp:62
static bool safeLoadFile(lua_State *L, const char *path, const char *display_name=NULL)
Definition s_security.cpp:434
static int sl_g_loadstring(lua_State *L)
Definition s_security.cpp:772
static bool checkPath(lua_State *L, const char *path, bool write_required, bool *write_allowed=NULL)
Definition s_security.cpp:525
int getThread(lua_State *L)
Definition s_security.cpp:378
static int sl_g_require(lua_State *L)
Definition s_security.cpp:795
static int sl_os_rename(lua_State *L)
Definition s_security.cpp:875
static int sl_io_open(lua_State *L)
Definition s_security.cpp:802
static int sl_g_loadfile(lua_State *L)
Definition s_security.cpp:729
static int sl_io_input(lua_State *L)
Definition s_security.cpp:830
static int sl_io_lines(lua_State *L)
Definition s_security.cpp:858
static int sl_g_dofile(lua_State *L)
Definition s_security.cpp:675
void createEmptyEnv(lua_State *L)
Definition s_security.cpp:389
static bool isSecure(lua_State *L)
Definition s_security.cpp:409
static bool safeLoadString(lua_State *L, const std::string &code, const char *chunk_name)
Definition s_security.cpp:423
static int sl_io_output(lua_State *L)
Definition s_security.cpp:844
static int sl_g_load(lua_State *L)
Definition s_security.cpp:690
static bool checkWhitelisted(lua_State *L, const std::string &setting)
Definition s_security.cpp:518
void setLuaEnv(lua_State *L, int thread)
Definition s_security.cpp:396