Sha256: ebb60f5819fbd355334a74cf54ed9b7d239b3f4364210b494c8eb4e1cec0c79d

Contents?: true

Size: 1.68 KB

Versions: 4

Compression:

Stored size: 1.68 KB

Contents

/*
* Based on Lua's all.c -- Lua core & libraries in a single file.
*/

#define luaall_c

#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"


// Include our custom modules
#include "libinjection/lualib.c"
#include "luautf8/lutf8lib.c"
#include "lpeg/lptree.c"
#include "lua-cmsgpack/lua_cmsgpack.c"
#include "lua-snapshot/snapshot.c"

static const luaL_Reg lj_lib_load[] = {
  // Default Lua modules
  //
  // SECURITY NOTE:
  // Some of the following modules are unsafe according to http://lua-users.org/wiki/SandBoxes.
  // They are loaded, but never exposed to the sandbox used to run the hook handlers.
  // See lib/boot.lua for more details.
  { "",               luaopen_base },
  { LUA_LOADLIBNAME,  luaopen_package },
  { LUA_TABLIBNAME,   luaopen_table },
  #if defined(LUA_UNSAFE_MODE)
    { LUA_IOLIBNAME,    luaopen_io },
    { LUA_OSLIBNAME,    luaopen_os },
  #endif
  { LUA_STRLIBNAME,   luaopen_string },
  { LUA_MATHLIBNAME,  luaopen_math },
  { LUA_DBLIBNAME,    luaopen_debug },
  { LUA_BITLIBNAME,   luaopen_bit },
  { LUA_JITLIBNAME,   luaopen_jit },

  // Our custom modules
  {"libinjection", luaopen_libinjection},
  {"utf8", luaopen_utf8},
  {"lpeg", luaopen_lpeg},
  {LUACMSGPACK_NAME, luaopen_cmsgpack},
  {"snapshot", luaopen_snapshot},

  { NULL,   NULL }
};

// In unsafe mode define these as NOPs when we build a .so
#if !defined(LUA_UNSAFE_MODE)
LUALIB_API int luaopen_io(lua_State *L) {
  return 0;
}
LUALIB_API int luaopen_os(lua_State *L) {
  return 0;
}
#endif

LUALIB_API void luaL_openlibs(lua_State *L) {
  const luaL_Reg *lib;
  for (lib = lj_lib_load; lib->func; lib++) {
    lua_pushcfunction(L, lib->func);
    lua_pushstring(L, lib->name);
    lua_call(L, 1, 0);
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
immunio-1.0.1 lua-hooks/ext/all.c
immunio-1.0.0 lua-hooks/ext/all.c
immunio-0.16.1 lua-hooks/ext/all.c
immunio-0.16.0 lua-hooks/ext/all.c