Skip to content

Commit f8730f4

Browse files
committed
lua: don't accept a table as a return value from match
Remove the half finished support for accepting a table returned from a Lua rule's match function. This is not documented, not tested, and not really implemented. Ticket: OISF#6941
1 parent 495a12f commit f8730f4

1 file changed

Lines changed: 3 additions & 33 deletions

File tree

src/detect-lua.c

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -219,39 +219,9 @@ static int DetectLuaRunMatch(
219219

220220
if (script_ret == 1.0)
221221
match = 1;
222-
223-
/* script returns a table */
224-
} else if (lua_type(tlua->luastate, 1) == LUA_TTABLE) {
225-
lua_pushnil(tlua->luastate);
226-
const char *k, *v;
227-
while (lua_next(tlua->luastate, -2)) {
228-
v = lua_tostring(tlua->luastate, -1);
229-
lua_pop(tlua->luastate, 1);
230-
k = lua_tostring(tlua->luastate, -1);
231-
232-
if (!k || !v)
233-
continue;
234-
235-
SCLogDebug("k='%s', v='%s'", k, v);
236-
237-
if (strcmp(k, "retval") == 0) {
238-
int val;
239-
if (StringParseInt32(&val, 10, 0, (const char *)v) < 0) {
240-
SCLogError("Invalid value "
241-
"for \"retval\" from LUA return table: '%s'",
242-
v);
243-
match = 0;
244-
}
245-
else if (val == 1) {
246-
match = 1;
247-
}
248-
} else {
249-
/* set flow var? */
250-
}
251-
}
252-
253-
/* pop the table */
254-
lua_pop(tlua->luastate, 1);
222+
} else {
223+
SCLogDebug("Unsupported datatype returned from Lua script");
224+
abort();
255225
}
256226
}
257227

0 commit comments

Comments
 (0)