mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Add mod security
Due to compatibility concerns, this is temporarily disabled.
This commit is contained in:
parent
f26421228b
commit
3a8c788880
22 changed files with 812 additions and 83 deletions
|
@ -35,6 +35,12 @@ extern "C" {
|
|||
|
||||
#define SCRIPTAPI_LOCK_DEBUG
|
||||
|
||||
#define SCRIPT_MOD_NAME_FIELD "current_mod_name"
|
||||
// MUST be an invalid mod name so that mods can't
|
||||
// use that name to bypass security!
|
||||
#define BUILTIN_MOD_NAME "*builtin*"
|
||||
|
||||
|
||||
class Server;
|
||||
class Environment;
|
||||
class GUIEngine;
|
||||
|
@ -42,17 +48,18 @@ class ServerActiveObject;
|
|||
|
||||
class ScriptApiBase {
|
||||
public:
|
||||
|
||||
ScriptApiBase();
|
||||
virtual ~ScriptApiBase();
|
||||
|
||||
bool loadMod(const std::string &scriptpath, const std::string &modname);
|
||||
bool loadScript(const std::string &scriptpath);
|
||||
bool loadMod(const std::string &script_path, const std::string &mod_name);
|
||||
bool loadScript(const std::string &script_path);
|
||||
|
||||
/* object */
|
||||
void addObjectReference(ServerActiveObject *cobj);
|
||||
void removeObjectReference(ServerActiveObject *cobj);
|
||||
|
||||
Server* getServer() { return m_server; }
|
||||
|
||||
protected:
|
||||
friend class LuaABM;
|
||||
friend class InvRef;
|
||||
|
@ -69,7 +76,6 @@ protected:
|
|||
void scriptError();
|
||||
void stackDump(std::ostream &o);
|
||||
|
||||
Server* getServer() { return m_server; }
|
||||
void setServer(Server* server) { m_server = server; }
|
||||
|
||||
Environment* getEnv() { return m_environment; }
|
||||
|
@ -84,6 +90,7 @@ protected:
|
|||
JMutex m_luastackmutex;
|
||||
// Stack index of Lua error handler
|
||||
int m_errorhandler;
|
||||
bool m_secure;
|
||||
#ifdef SCRIPTAPI_LOCK_DEBUG
|
||||
bool m_locked;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue