Squashed commit of the following:
commit
76fd90fe0d4c2d5be45f900600398224ccf3b25f
Author: Masud Hasan <mashasan@cisco.com>
Date: Thu Oct 24 13:38:31 2019 -0400
policy: Avoid unintended insertion of policy into map if it does not exist
{ user_network[p->user_policy_id] = p; }
IpsPolicy* get_user_ips(unsigned user_id)
- { return user_ips[user_id]; }
+ {
+ auto it = user_ips.find(user_id);
+ return it == user_ips.end() ? nullptr : it->second;
+ }
NetworkPolicy* get_user_network(unsigned user_id)
- { return user_network[user_id]; }
+ {
+ auto it = user_network.find(user_id);
+ return it == user_network.end() ? nullptr : it->second;
+ }
InspectionPolicy* get_inspection_policy(unsigned i = 0)
{ return i < inspection_policy.size() ? inspection_policy[i] : nullptr; }