summaryrefslogtreecommitdiff
path: root/implementation/security
diff options
context:
space:
mode:
Diffstat (limited to 'implementation/security')
-rw-r--r--implementation/security/src/policy.cpp8
-rw-r--r--implementation/security/src/security_impl.cpp28
2 files changed, 18 insertions, 18 deletions
diff --git a/implementation/security/src/policy.cpp b/implementation/security/src/policy.cpp
index 4babd06..9630e5f 100644
--- a/implementation/security/src/policy.cpp
+++ b/implementation/security/src/policy.cpp
@@ -175,7 +175,7 @@ policy::deserialize_ids(const byte_t * &_data, uint32_t &_size,
if (its_result == false)
return (false);
- for (const auto i : its_instances)
+ for (const auto& i : its_instances)
its_ids += std::make_pair(i, its_methods);
its_array_length -= (its_current_size - _size);
@@ -305,7 +305,7 @@ policy::serialize(std::vector<byte_t> &_data) const {
uint32_t its_requests_size(0);
serialize_u32(its_requests_size, _data);
- for (const auto its_request : requests_) {
+ for (const auto& its_request : requests_) {
for (auto its_service = its_request.first.lower();
its_service <= its_request.first.upper();
its_service++) {
@@ -316,7 +316,7 @@ policy::serialize(std::vector<byte_t> &_data) const {
uint32_t its_instances_size(0);
serialize_u32(its_instances_size, _data);
- for (const auto i : its_request.second) {
+ for (const auto& i : its_request.second) {
boost::icl::interval_set<instance_t> its_instances;
its_instances.insert(i.first);
serialize_interval_set(its_instances, _data);
@@ -378,7 +378,7 @@ policy::serialize_interval_set(
uint32_t its_interval_set_size(0);
serialize_u32(its_interval_set_size, _data);
- for (const auto i : _intervals)
+ for (const auto& i : _intervals)
serialize_interval(i, _data);
its_interval_set_size = static_cast<uint32_t>(_data.size()
diff --git a/implementation/security/src/security_impl.cpp b/implementation/security/src/security_impl.cpp
index 12bb9db..8a3d276 100644
--- a/implementation/security/src/security_impl.cpp
+++ b/implementation/security/src/security_impl.cpp
@@ -470,7 +470,7 @@ security_impl::update_security_policy(uint32_t _uid, uint32_t _gid,
}
if (its_matching_policy) {
- for (const auto r : _policy->requests_) {
+ for (const auto& r : _policy->requests_) {
service_t its_lower, its_upper;
get_bounds(r.first, its_lower, its_upper);
for (auto s = its_lower; s <= its_upper; s++) {
@@ -479,7 +479,7 @@ security_impl::update_security_policy(uint32_t _uid, uint32_t _gid,
its_matching_policy->requests_ += std::make_pair(its_service, r.second);
}
}
- for (const auto o : _policy->offers_) {
+ for (const auto& o : _policy->offers_) {
service_t its_lower, its_upper;
get_bounds(o.first, its_lower, its_upper);
for (auto s = its_lower; s <= its_upper; s++) {
@@ -758,7 +758,7 @@ security_impl::load_policy(const boost::property_tree::ptree &_tree) {
policy->allow_who_ = true;
}
if (has_uid_range && has_gid_range) {
- for (const auto u : its_uid_interval_set)
+ for (const auto& u : its_uid_interval_set)
policy->credentials_ += std::make_pair(u, its_gid_interval_set);
policy->allow_who_ = true;
}
@@ -819,7 +819,7 @@ security_impl::load_policy_body(std::shared_ptr<policy> &_policy,
its_instance_interval_set.insert(all_instances);
its_method_interval_set.insert(all_methods);
}
- for (const auto i : its_instance_interval_set) {
+ for (const auto& i : its_instance_interval_set) {
its_instance_method_intervals
+= std::make_pair(i, its_method_interval_set);
}
@@ -838,7 +838,7 @@ security_impl::load_policy_body(std::shared_ptr<policy> &_policy,
}
if (its_method_interval_set.empty())
its_method_interval_set.insert(all_methods);
- for (const auto i : its_instance_interval_set) {
+ for (const auto& i : its_instance_interval_set) {
its_instance_method_intervals
+= std::make_pair(i, its_method_interval_set);
}
@@ -853,7 +853,7 @@ security_impl::load_policy_body(std::shared_ptr<policy> &_policy,
// try to only load instance ranges with any method to be allowed
load_interval_set(k->second, its_legacy_instance_interval_set);
- for (const auto i : its_legacy_instance_interval_set) {
+ for (const auto& i : its_legacy_instance_interval_set) {
its_instance_method_intervals
+= std::make_pair(i, its_legacy_method_interval_set);
}
@@ -929,7 +929,7 @@ security_impl::load_credential(
}
}
- for (const auto its_uid_interval : its_uid_interval_set) {
+ for (const auto& its_uid_interval : its_uid_interval_set) {
_credentials
+= std::make_pair(its_uid_interval, its_gid_interval_set);
}
@@ -1081,8 +1081,8 @@ security_impl::get_requester_policies(const std::shared_ptr<policy> _policy,
}
std::lock_guard<std::mutex> its_lock(_policy->mutex_);
- for (const auto o : _policy->offers_) {
- for (const auto p : its_policies) {
+ for (const auto& o : _policy->offers_) {
+ for (const auto& p : its_policies) {
if (p == _policy)
continue;
@@ -1091,7 +1091,7 @@ security_impl::get_requester_policies(const std::shared_ptr<policy> _policy,
auto its_policy = std::make_shared<policy>();
its_policy->credentials_ = p->credentials_;
- for (const auto r : p->requests_) {
+ for (const auto& r : p->requests_) {
// o represents an offer by a service interval and its instances
// (a set of intervals)
// r represents a request by a service interval and its instances
@@ -1109,9 +1109,9 @@ security_impl::get_requester_policies(const std::shared_ptr<policy> _policy,
auto its_service_min = std::max(its_o_lower, its_r_lower);
auto its_service_max = std::min(its_r_upper, its_o_upper);
- for (const auto i : o.second) {
- for (const auto j : r.second) {
- for (const auto k : j.second) {
+ for (const auto& i : o.second) {
+ for (const auto& j : r.second) {
+ for (const auto& k : j.second) {
instance_t its_i_lower, its_i_upper, its_k_lower, its_k_upper;
get_bounds(i, its_i_lower, its_i_upper);
get_bounds(k, its_k_lower, its_k_upper);
@@ -1151,7 +1151,7 @@ security_impl::get_clients(uid_t _uid, gid_t _gid,
std::unordered_set<client_t> &_clients) const {
std::lock_guard<std::mutex> its_lock(ids_mutex_);
- for (const auto i : ids_) {
+ for (const auto& i : ids_) {
if (i.second.first == _uid && i.second.second == _gid)
_clients.insert(i.first);
}