From: Mike Stepanek (mstepane) Date: Mon, 8 Oct 2018 13:28:08 +0000 (-0400) Subject: Merge pull request #1374 in SNORT/snort3 from reload_module_fix to master X-Git-Tag: 3.0.0-249~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb497e6cf4095a0c71173687b1f5752ac019118a;p=thirdparty%2Fsnort3.git Merge pull request #1374 in SNORT/snort3 from reload_module_fix to master Squashed commit of the following: commit 721f5381733609f3fcf65a5689b50323424fd06a Author: Silviu Minut Date: Thu Sep 27 11:32:00 2018 -0400 main: initialize shell_map and other maps in PolicyMap::clone(). Some pointers need to be updated during reloads based on some map lookups, which would fail quietly if those maps are not initialized during clone. --- diff --git a/src/main/policy.cc b/src/main/policy.cc index 07e1cda02..c4036fe85 100644 --- a/src/main/policy.cc +++ b/src/main/policy.cc @@ -192,6 +192,27 @@ void PolicyMap::clone(PolicyMap *other_map) else inspection_policy.push_back(other_map->inspection_policy[i]); } + + shell_map = other_map->shell_map; + + // Fix references to inspection_policy[0] + for ( auto p : other_map->shell_map ) + { + if ( p.second->inspection == other_map->inspection_policy[0] ) + shell_map[p.first]->inspection = inspection_policy[0]; + } + + user_inspection = other_map->user_inspection; + + // Fix references to inspection_policy[0] + for ( auto p : other_map->user_inspection ) + { + if ( p.second == other_map->inspection_policy[0] ) + user_inspection[p.first] = inspection_policy[0]; + } + + user_ips = other_map->user_ips; + user_network = other_map->user_network; } unsigned PolicyMap::add_inspection_shell(Shell* sh)