]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4105: appid: Additional checks for lua logging
authorOleksandr Stepanov -X (ostepano - SOFTSERVE INC at Cisco) <ostepano@cisco.com>
Mon, 27 Nov 2023 18:19:21 +0000 (18:19 +0000)
committerChris Sherwin (chsherwi) <chsherwi@cisco.com>
Mon, 27 Nov 2023 18:19:21 +0000 (18:19 +0000)
Merge in SNORT/snort3 from ~OSTEPANO/snort3:lua_debug_fix to master

Squashed commit of the following:

commit 703b39ee1da25cf5cb52c5b0df2267d7da98cac5
Author: Oleksandr Stepanov <ostepano@cisco.com>
Date:   Mon Nov 20 07:34:24 2023 -0500

    appid: Additional check for lua logging

src/network_inspectors/appid/lua_detector_api.cc

index ca55a53e9adc49eeb46f29f26245713bd51b14a8..8d669da0fa28c1a65ed4c80c63be7e8917d5c9b5 100644 (file)
@@ -377,10 +377,8 @@ static int detector_log_snort_message(lua_State* L)
         break;
 
     case LUA_LOG_TRACE:
-        appid_log(init(L) ? nullptr : CURRENT_PACKET, TRACE_DEBUG_LEVEL, "%s:%s\n", name.c_str(), message);
-        break;
-
-    default:
+        auto curr_packet = (Analyzer::get_local_analyzer() and snort::DetectionEngine::get_context()) ? snort::DetectionEngine::get_current_packet() : nullptr;
+        appid_log(curr_packet, TRACE_DEBUG_LEVEL, curr_packet ? "%s:%s\n" : "AppIdDbg %s:%s\n", name.c_str(), message);
         break;
     }