From: Mike Stepanek (mstepane) Date: Fri, 22 Nov 2019 20:20:10 +0000 (+0000) Subject: Merge pull request #1852 in SNORT/snort3 from ~NIHDESAI/snort3:ftp_cmds to master X-Git-Tag: 3.0.0-265~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8da1c434ff84793f0711cc556bea525be820767b;p=thirdparty%2Fsnort3.git Merge pull request #1852 in SNORT/snort3 from ~NIHDESAI/snort3:ftp_cmds to master Squashed commit of the following: commit 72471dda4db4c0467871065d166c187cdfefb720 Author: Nihal Desai Date: Mon Nov 18 16:15:52 2019 -0500 ftp: handling multiple ftp server config validation --- diff --git a/src/managers/module_manager.cc b/src/managers/module_manager.cc index c97785b0d..16e062734 100644 --- a/src/managers/module_manager.cc +++ b/src/managers/module_manager.cc @@ -781,19 +781,27 @@ SO_PUBLIC void close_table(const char* s, int idx) string key = fqn; set_top(key); + const bool top = !idx && key == s; + if ( ModHook* h = get_hook(key.c_str()) ) { if ( !end(h->mod, nullptr, s, idx) ) ParseError("can't close %s", h->mod->get_name()); - else if ( !s_name.empty() ) - PluginManager::instantiate(h->api, h->mod, s_config, s_name.c_str()); + else if (h->api && top) + { + if ( !s_name.empty() ) + PluginManager::instantiate(h->api, h->mod, s_config, s_name.c_str()); + else + PluginManager::instantiate(h->api, h->mod, s_config); + } + } - else if ( !idx && h->api && (key == s) ) - PluginManager::instantiate(h->api, h->mod, s_config); + if ( top ) + { + s_name.clear(); + s_type.clear(); } - s_name.clear(); - s_type.clear(); } SO_PUBLIC bool set_bool(const char* fqn, bool b)