From: Vedansh Bhartia Date: Tue, 16 May 2023 15:49:49 +0000 (+0530) Subject: rgw: Do not forward functor objects in rgw_iam_policy.h X-Git-Tag: v19.0.0~1015^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ec5d0bdfd1632c1109b6dab119c3f0d41d182a7b;p=ceph.git rgw: Do not forward functor objects in rgw_iam_policy.h rgw_iam_policy.h implements the andible, orrible, and shortible methods which called forward on functor objects called in a loop. This does not have any effect currently since the callers do not pass stateful functors. However, in case a stateful functor that is also an rvalue is used, the forward would cause it to lose its state. Signed-off-by: Vedansh Bhartia --- diff --git a/src/rgw/rgw_iam_policy.h b/src/rgw/rgw_iam_policy.h index c0a7e51b5fd7..c60872850a30 100644 --- a/src/rgw/rgw_iam_policy.h +++ b/src/rgw/rgw_iam_policy.h @@ -404,7 +404,7 @@ struct Condition { for (auto itr = it.first; itr != it.second; itr++) { bool matched = false; for (const auto& d : v) { - if (std::forward(f)(itr->second, d)) { + if (f(itr->second, d)) { matched = true; } } @@ -419,7 +419,7 @@ struct Condition { const std::vector& v) { for (auto itr = it.first; itr != it.second; itr++) { for (const auto& d : v) { - if (std::forward(f)(itr->second, d)) { + if (f(itr->second, d)) { return true; } } @@ -436,13 +436,13 @@ struct Condition { } for (const auto& d : v) { - auto xd = std::forward(x)(d); + auto xd = x(d); if (!xd) { - continue; + continue; } - if (std::forward(f)(*xc, *xd)) { - return true; + if (f(*xc, *xd)) { + return true; } } return false;