diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-09-16 14:33:16 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-06-11 17:48:03 +0300 |
commit | e3307250cef5efb0c7f27f4bd7451a4bb294adfa (patch) | |
tree | a31d22def54e5bd4fb3768559f09c1a37e65bc3c /rpmio/rpmlua.c | |
parent | 81228b7becb2612321adc779755facb4d93596e4 (diff) | |
download | librpm-tizen-e3307250cef5efb0c7f27f4bd7451a4bb294adfa.tar.gz librpm-tizen-e3307250cef5efb0c7f27f4bd7451a4bb294adfa.tar.bz2 librpm-tizen-e3307250cef5efb0c7f27f4bd7451a4bb294adfa.zip |
lua: Enable Lua
However, disable the "io" and "os" standard libraries and only enable
the access() function from the "posix" extension library.
Change-Id: If3b5f0776f6684af4ebaeb7bff742ab9a2123221
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'rpmio/rpmlua.c')
-rw-r--r-- | rpmio/rpmlua.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/rpmio/rpmlua.c b/rpmio/rpmlua.c index 49ae7a0aa..8e6841d4e 100644 --- a/rpmio/rpmlua.c +++ b/rpmio/rpmlua.c @@ -72,7 +72,7 @@ rpmlua rpmluaNew() {"posix", luaopen_posix}, {"rex", luaopen_rex}, {"rpm", luaopen_rpm}, - {"os", luaopen_rpm_os}, + /*{"os", luaopen_rpm_os},*/ {NULL, NULL}, }; @@ -86,6 +86,12 @@ rpmlua rpmluaNew() lua_call(L, 1, 0); lua_settop(L, 0); } + /* Disable os and io standard libraries */ + lua_pushnil (L); + lua_setglobal(L, "os"); + lua_pushnil (L); + lua_setglobal(L, "io"); + #ifndef LUA_GLOBALSINDEX lua_pushglobaltable(L); #endif @@ -516,11 +522,6 @@ int rpmluaRunScript(rpmlua _lua, const char *script, const char *name) INITSTATE(_lua, lua); lua_State *L = lua->L; int ret = 0; -#define LUA_OUTPUT "UNEXPANDEDLUASCRIPT" - rpmlog(RPMLOG_WARNING, _("Refusing to run lua code: %s\n"), script); - lua->printbuf->buf = xcalloc(1, sizeof(LUA_OUTPUT)); - strcpy(lua->printbuf->buf, LUA_OUTPUT); -#if 0 if (name == NULL) name = "<lua>"; if (luaL_loadbuffer(L, script, strlen(script), name) != 0) { @@ -534,7 +535,6 @@ int rpmluaRunScript(rpmlua _lua, const char *script, const char *name) lua_pop(L, 1); ret = -1; } -#endif return ret; } |