]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect-lua: set tx ptr
authorVictor Julien <victor@inliniac.net>
Thu, 14 Aug 2014 14:33:37 +0000 (16:33 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 15 Aug 2014 11:58:27 +0000 (13:58 +0200)
Set tx ptr so it can be used later by other keywords.

src/detect-lua-extensions.c

index c29b30091377cf72917e73b23f2ff392a7f7f1f3..222b6e55b3d69a5ad13e51a0248451e33aef22bd 100644 (file)
@@ -58,6 +58,8 @@
 #include "queue.h"
 #include "util-cpu.h"
 
+#include "app-layer-parser.h"
+
 #ifdef HAVE_LUA
 
 #include "util-lua.h"
@@ -569,6 +571,15 @@ void LuaExtensionsMatchSetup(lua_State *lua_state, DetectLuaData *ld, DetectEngi
     lua_settable(lua_state, LUA_REGISTRYINDEX);
 
     LuaStateSetFlow(lua_state, f, flow_locked);
+
+    if (det_ctx->tx_id_set && flow_locked == LUA_FLOW_LOCKED_BY_PARENT) {
+        if (f && f->alstate) {
+            void *txptr = AppLayerParserGetTx(f->proto, f->alproto, f->alstate, det_ctx->tx_id);
+            if (txptr) {
+                LuaStateSetTX(lua_state, txptr);
+            }
+        }
+    }
 }
 
 /**