lua: remove internal references to luajit

pull/11165/head
Jo Johnson 2 years ago committed by Jason Ish
parent d5c6c3a21c
commit 01c8af766c

@ -124,7 +124,7 @@ static int GetFlowVarById(lua_State *luastate, Flow *f,
LUA_ERROR("flowvar id not a number");
}
int id = lua_tonumber(luastate, 1);
if (id < 0 || id >= DETECT_LUAJIT_MAX_FLOWVARS) {
if (id < 0 || id >= DETECT_LUA_MAX_FLOWVARS) {
LUA_ERROR("flowvar id out of range");
}
uint32_t idx = ld->flowvar[id];
@ -185,7 +185,7 @@ static int GetFlowIntById(lua_State *luastate, Flow *f,
LUA_ERROR("flowvar id not a number");
}
int id = lua_tonumber(luastate, 1);
if (id < 0 || id >= DETECT_LUAJIT_MAX_FLOWVARS) {
if (id < 0 || id >= DETECT_LUA_MAX_FLOWVARS) {
LUA_ERROR("flowvar id out of range");
}
uint32_t idx = ld->flowint[id];
@ -391,7 +391,7 @@ static int LuaSetFlowint(lua_State *luastate)
LUA_ERROR("1st arg not a number");
}
int id = lua_tonumber(luastate, 1);
if (id < 0 || id >= DETECT_LUAJIT_MAX_FLOWVARS) {
if (id < 0 || id >= DETECT_LUA_MAX_FLOWVARS) {
LUA_ERROR("flowint id out of range");
}
@ -496,7 +496,7 @@ static int LuaGetByteVar(lua_State *luastate)
LUA_ERROR("bytevar id not a number");
}
int id = lua_tonumber(luastate, 1);
if (id < 0 || id >= DETECT_LUAJIT_MAX_BYTEVARS) {
if (id < 0 || id >= DETECT_LUA_MAX_BYTEVARS) {
LUA_ERROR("bytevar id out of range");
}
uint32_t idx = ld->bytevar[id];

@ -60,7 +60,7 @@
static int DetectLuaSetupNoSupport (DetectEngineCtx *a, Signature *b, const char *c)
{
SCLogError("no Lua support built in, needed for lua/luajit keyword");
SCLogError("no Lua support built in, needed for lua keyword");
return -1;
}
@ -70,7 +70,6 @@ static int DetectLuaSetupNoSupport (DetectEngineCtx *a, Signature *b, const char
void DetectLuaRegister(void)
{
sigmatch_table[DETECT_LUA].name = "lua";
sigmatch_table[DETECT_LUA].alias = "luajit";
sigmatch_table[DETECT_LUA].desc = "support for lua scripting";
sigmatch_table[DETECT_LUA].url = "/rules/rule-lua-scripting.html";
sigmatch_table[DETECT_LUA].Setup = DetectLuaSetupNoSupport;
@ -104,7 +103,6 @@ static int g_smtp_generic_list_id = 0;
void DetectLuaRegister(void)
{
sigmatch_table[DETECT_LUA].name = "lua";
sigmatch_table[DETECT_LUA].alias = "luajit";
sigmatch_table[DETECT_LUA].desc = "match via a lua script";
sigmatch_table[DETECT_LUA].url = "/rules/rule-lua-scripting.html";
sigmatch_table[DETECT_LUA].Match = DetectLuaMatch;
@ -662,7 +660,7 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
/* removes 'value'; keeps 'key' for next iteration */
lua_pop(luastate, 1);
if (ld->flowvars == DETECT_LUAJIT_MAX_FLOWVARS) {
if (ld->flowvars == DETECT_LUA_MAX_FLOWVARS) {
SCLogError("too many flowvars registered");
goto error;
}
@ -684,7 +682,7 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
/* removes 'value'; keeps 'key' for next iteration */
lua_pop(luastate, 1);
if (ld->flowints == DETECT_LUAJIT_MAX_FLOWINTS) {
if (ld->flowints == DETECT_LUA_MAX_FLOWINTS) {
SCLogError("too many flowints registered");
goto error;
}
@ -706,7 +704,7 @@ static int DetectLuaSetupPrime(DetectEngineCtx *de_ctx, DetectLuaData *ld, const
/* removes 'value'; keeps 'key' for next iteration */
lua_pop(luastate, 1);
if (ld->bytevars == DETECT_LUAJIT_MAX_BYTEVARS) {
if (ld->bytevars == DETECT_LUA_MAX_BYTEVARS) {
SCLogError("too many bytevars registered");
goto error;
}

@ -34,9 +34,9 @@ typedef struct DetectLuaThreadData {
int alproto;
} DetectLuaThreadData;
#define DETECT_LUAJIT_MAX_FLOWVARS 15
#define DETECT_LUAJIT_MAX_FLOWINTS 15
#define DETECT_LUAJIT_MAX_BYTEVARS 15
#define DETECT_LUA_MAX_FLOWVARS 15
#define DETECT_LUA_MAX_FLOWINTS 15
#define DETECT_LUA_MAX_BYTEVARS 15
typedef struct DetectLuaData {
int thread_ctx_id;
@ -45,12 +45,12 @@ typedef struct DetectLuaData {
uint32_t flags;
AppProto alproto;
char *buffername; /* buffer name in case of a single buffer */
uint32_t flowint[DETECT_LUAJIT_MAX_FLOWINTS];
uint32_t flowint[DETECT_LUA_MAX_FLOWINTS];
uint16_t flowints;
uint16_t flowvars;
uint32_t flowvar[DETECT_LUAJIT_MAX_FLOWVARS];
uint32_t flowvar[DETECT_LUA_MAX_FLOWVARS];
uint16_t bytevars;
uint32_t bytevar[DETECT_LUAJIT_MAX_BYTEVARS];
uint32_t bytevar[DETECT_LUA_MAX_BYTEVARS];
uint32_t sid;
uint32_t rev;
uint32_t gid;

Loading…
Cancel
Save