Squashed commit of the following:
commit
7fcf2e12927d6e6511d7d3b03efbbdc2f96ce0a0
Author: Silviu Minut <sminut@cisco.com>
Date: Mon Sep 23 12:54:40 2019 -0400
reputation: prevent reload module crash when reputation is not configured in lua at startup.
SnortConfig* Snort::get_updated_policy(SnortConfig* other_conf, const char* fname, const char* iname)
{
reloading = true;
+ reset_parse_errors();
SnortConfig* sc = new SnortConfig(other_conf);
if ( name )
{
+ reset_parse_errors();
ModuleManager::reset_errors();
ModuleManager::reload_module(name, sc);
if ( ModuleManager::get_errors() || !sc->verify() )
if ( h and h->api and h->mod and sc )
{
PluginManager::instantiate(h->api, h->mod, sc);
-
+ s_errors += get_parse_errors();
}
else
{
static Inspector* reputation_ctor(Module* m)
{
ReputationModule* mod = (ReputationModule*)m;
- return new Reputation(mod->get_data());
+ ReputationConfig* conf = mod->get_data();
+ return conf ? new Reputation(conf) : nullptr;
}
static void reputation_dtor(Inspector* p)
#else
const BaseApi* nin_reputation = &reputation_api.base;
#endif
-
ReputationConfig* ReputationModule::get_data()
{
+
+ // FIXIT-M: this needs to be set to NULL prior to returning here.
+ // If we do that, though, reload module will error out, even when
+ // reputation has been properly configured (on startup) in lua.
return conf;
}