]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3974: search_engines: allow a snort config to be passed to find_all
authorRon Dempster (rdempste) <rdempste@cisco.com>
Tue, 29 Aug 2023 12:08:51 +0000 (12:08 +0000)
committerRon Dempster (rdempste) <rdempste@cisco.com>
Tue, 29 Aug 2023 12:08:51 +0000 (12:08 +0000)
Merge in SNORT/snort3 from ~RDEMPSTE/snort3:wild_card to master

Squashed commit of the following:

commit ee1aa0de6b0ebe3449eb870b9581299074cea966
Author: Ron Dempster (rdempste) <rdempste@cisco.com>
Date:   Thu Aug 24 15:58:32 2023 -0400

    search_engines: allow a snort config to be passed to find_all

src/network_inspectors/appid/client_plugins/test/eve_ca_patterns_test.cc
src/network_inspectors/appid/detector_plugins/test/detector_sip_test.cc
src/network_inspectors/appid/detector_plugins/test/http_url_patterns_test.cc
src/network_inspectors/appid/service_plugins/test/alpn_patterns_tests.cc
src/network_inspectors/rna/test/ua_fp_stubs.cc
src/search_engines/search_tool.cc
src/search_engines/search_tool.h

index 74973c962c181eb4db61cd3deef3eaedafea2681..03f2509c2e508130cffc6b405d7ad804babcbac8 100644 (file)
@@ -35,7 +35,7 @@ EveCaPattern eve_ca(APPID_UT_ID, "firefox", 90);
 
 namespace snort
 {
-int SearchTool::find_all(const char* pattern, unsigned, MpseMatch, bool, void* data)
+int SearchTool::find_all(const char* pattern, unsigned, MpseMatch, bool, void* data, const SnortConfig*)
 {
     if (strcmp(pattern, "firefox") == 0)
         eve_ca_pattern_match(&eve_ca, nullptr, 0, data, nullptr);
index ef1208e3a9c3dc161e09ff76ff014cafc29bcfda..e70bdff0eb870a8f94f0bb2a8b34a58c80134795 100644 (file)
@@ -70,7 +70,7 @@ SearchTool::SearchTool(bool)
     mpsegrp = &mpse_group;
 }
 void SearchTool::reload() { }  // LCOV_EXCL_LINE
-int SearchTool::find_all(const char*, unsigned, MpseMatch, bool, void*)
+int SearchTool::find_all(const char*, unsigned, MpseMatch, bool, void*, const SnortConfig*)
 {
     // Seg-fault will be observed if this is called without initializing pattern matchers
     assert(mpsegrp);
index 700873df7ec72873ddbe89f1f707f0a1b7bccace..5929a5bed11467ad0bc818a183453616244773a1 100644 (file)
@@ -65,7 +65,7 @@ void SearchTool::reload() { }
 static bool test_find_all_done = false;
 static bool test_find_all_enabled = false;
 static MatchedPatterns* mock_mp = nullptr;
-int SearchTool::find_all(const char*, unsigned, MpseMatch, bool, void* mp_arg)
+int SearchTool::find_all(const char*, unsigned, MpseMatch, bool, void* mp_arg, const SnortConfig*)
 {
     test_find_all_done = true;
     if (test_find_all_enabled)
index f16dd06627691f2e6a1c08302759f446a6490b58..3b5ec90502b4cad34d508c44dd3cdab319b1f6f8 100644 (file)
@@ -35,7 +35,7 @@ AlpnPattern alpn_pattern(APPID_UT_ID, "h3");
 
 namespace snort
 {
-int SearchTool::find_all(const char* pattern, unsigned, MpseMatch, bool, void* data)
+int SearchTool::find_all(const char* pattern, unsigned, MpseMatch, bool, void* data, const SnortConfig*)
 {
     if (strcmp(pattern, "h3") == 0)
         alpn_pattern_match(&alpn_pattern, nullptr, 0, data, nullptr);
index 732479fd0c3713bde8b598414c15b41c01442066..1f8fccd8c89990ba9af83dd4672eaf747e751183 100644 (file)
@@ -38,7 +38,7 @@ int SearchTool::find(const char*, unsigned, MpseMatch, int&, bool, void*)
 int SearchTool::find(const char*, unsigned, MpseMatch, bool, void*)
 { return 0; }
 
-int SearchTool::find_all(const char*, unsigned, MpseMatch, bool, void*)
+int SearchTool::find_all(const char*, unsigned, MpseMatch, bool, void*, const SnortConfig*)
 { return 0; }
 }
 
index 613b8ae70276b190693f03482eea585d2267686a..f8aebd0aa641bdd572649f84fcd61b6e9af8d10d 100644 (file)
@@ -134,10 +134,11 @@ int SearchTool::find(
 }
 
 int SearchTool::find_all(
-    const char* str, unsigned len, MpseMatch mf, bool confine, void* user_data)
+    const char* str, unsigned len, MpseMatch mf, bool confine, void* user_data, const SnortConfig* sc)
 {
     int num = 0;
-    const SnortConfig* sc = SnortConfig::get_conf();
+    if (!sc)
+        sc = SnortConfig::get_conf();
     const FastPatternConfig* fp = sc->fast_pattern_config;
 
     if ( confine && max_len > 0 )
index 1fb6a7dcee9b8645f783b375292736225587ecd8..6e0427f00ba54c56f120e50ea2ec70fbe1296cd2 100644 (file)
@@ -57,7 +57,7 @@ public:
         bool confine = false, void* user_data = nullptr);
 
     int find_all(const char* s, unsigned s_len, MpseMatch,
-        bool confine = false, void* user_data = nullptr);
+        bool confine = false, void* user_data = nullptr, const SnortConfig* = nullptr);
 
 private:
     class MpseGroup* mpsegrp;