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
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);
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);
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)
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);
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; }
}
}
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 )
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;