]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Do not forward functor objects in rgw_iam_policy.h 51676/head
authorVedansh Bhartia <vedanshbhartia@gmail.com>
Tue, 16 May 2023 15:49:49 +0000 (21:19 +0530)
committerVedansh Bhartia <vedanshbhartia@gmail.com>
Mon, 22 May 2023 20:16:13 +0000 (01:46 +0530)
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 <vedanshbhartia@gmail.com>
src/rgw/rgw_iam_policy.h

index c0a7e51b5fd7e8f7fdce253f97e89575c2b2f0ab..c60872850a309878ca07e725013ed3e0e559ee74 100644 (file)
@@ -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>(f)(itr->second, d)) {
+        if (f(itr->second, d)) {
                matched = true;
       }
      }
@@ -419,7 +419,7 @@ struct Condition {
                      const std::vector<std::string>& v) {
     for (auto itr = it.first; itr != it.second; itr++) {
       for (const auto& d : v) {
-        if (std::forward<F>(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>(x)(d);
+      auto xd = x(d);
       if (!xd) {
-       continue;
+        continue;
       }
 
-      if (std::forward<F>(f)(*xc, *xd)) {
-       return true;
+      if (f(*xc, *xd)) {
+        return true;
       }
     }
     return false;