summaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_base.h
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-09-05 20:08:51 -0400
committerShadowNinja <shadowninja@minetest.net>2015-05-16 18:32:31 -0400
commit3a8c7888807e4483bbdb3edd81c9893f3e2f427d (patch)
tree81f339e5f61b03e8d7842e06f034d09bf59dba96 /src/script/cpp_api/s_base.h
parentf26421228bbd31f02bf16b45a4b82be84f233e52 (diff)
downloadminetest-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/cpp_api/s_base.h')
-rw-r--r--src/script/cpp_api/s_base.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/script/cpp_api/s_base.h b/src/script/cpp_api/s_base.h
index 4ea3677a9..cf9b7b934 100644
--- a/src/script/cpp_api/s_base.h
+++ b/src/script/cpp_api/s_base.h
@@ -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