]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1852 in SNORT/snort3 from ~NIHDESAI/snort3:ftp_cmds to master
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Fri, 22 Nov 2019 20:20:10 +0000 (20:20 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Fri, 22 Nov 2019 20:20:10 +0000 (20:20 +0000)
Squashed commit of the following:

commit 72471dda4db4c0467871065d166c187cdfefb720
Author: Nihal Desai <nihdesai@cisco.com>
Date:   Mon Nov 18 16:15:52 2019 -0500

    ftp: handling multiple ftp server config validation

src/managers/module_manager.cc

index c97785b0d902c9c1a2fe5c325e486c072537e2b9..16e0627340648b59eeb218e5fbfd90cdfb31ebde 100644 (file)
@@ -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)