Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
s_security.cpp File Reference
#include "cpp_api/s_security.h"
#include "lua_api/l_base.h"
#include "filesys.h"
#include "porting.h"
#include "server.h"
#include "client/client.h"
#include "settings.h"
#include <cerrno>
#include <string>
#include <algorithm>
#include <iostream>
+ Include dependency graph for s_security.cpp:

Macros

#define SECURE_API(lib, name)
 

Functions

static void copy_safe (lua_State *L, const char *list[], unsigned len, int from=-2, int to=-1)
 
static void shallow_copy_table (lua_State *L, int from=-2, int to=-1)
 
static void push_original (lua_State *L, const char *lib, const char *func)
 
bool checkModNameWhitelisted (const std::string &mod_name, const std::string &setting)
 

Macro Definition Documentation

◆ SECURE_API

#define SECURE_API (   lib,
  name 
)
Value:
lua_pushcfunction(L, sl_##lib##_##name); \
lua_setfield(L, -2, #name);
#define _(String)
Definition: gettext.h:42

Function Documentation

◆ checkModNameWhitelisted()

bool checkModNameWhitelisted ( const std::string &  mod_name,
const std::string &  setting 
)

References CONTAINS, g_settings, Settings::get(), str_split(), and str_starts_with().

Referenced by ScriptApiSecurity::checkPath(), and ScriptApiSecurity::checkWhitelisted().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copy_safe()

static void copy_safe ( lua_State *  L,
const char *  list[],
unsigned  len,
int  from = -2,
int  to = -1 
)
inlinestatic

Referenced by ScriptApiSecurity::initializeSecurity(), and ScriptApiSecurity::initializeSecurityClient().

+ Here is the caller graph for this function:

◆ push_original()

static void push_original ( lua_State *  L,
const char *  lib,
const char *  func 
)
inlinestatic

References CUSTOM_RIDX_GLOBALS_BACKUP.

Referenced by ScriptApiSecurity::sl_io_input(), ScriptApiSecurity::sl_io_lines(), ScriptApiSecurity::sl_io_open(), ScriptApiSecurity::sl_io_output(), ScriptApiSecurity::sl_os_remove(), ScriptApiSecurity::sl_os_rename(), and ScriptApiSecurity::sl_os_setlocale().

+ Here is the caller graph for this function:

◆ shallow_copy_table()

static void shallow_copy_table ( lua_State *  L,
int  from = -2,
int  to = -1 
)
static

Referenced by ScriptApiSecurity::initializeSecurity().

+ Here is the caller graph for this function: