]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/acl: create_policy_from_headers() can yield
authorCasey Bodley <cbodley@redhat.com>
Sat, 16 Dec 2023 23:34:34 +0000 (18:34 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 12 Apr 2024 19:34:26 +0000 (15:34 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit e8f078188d22c3ceb55fb6893f314bb651ba4829)

src/rgw/rgw_acl_s3.cc
src/rgw/rgw_acl_s3.h
src/rgw/rgw_rest_s3.cc

index 1e57d905389485c64bdc4faf5e76b60ac18ed339..37d7142c001cce80b45af58460817f0bfda45fa3 100644 (file)
@@ -335,6 +335,7 @@ static int read_aclowner_by_email(const DoutPrefixProvider* dpp,
 }
 
 static int parse_grantee_str(const DoutPrefixProvider* dpp,
+                             optional_yield y,
                              rgw::sal::Driver* driver,
                              const std::string& grantee_str,
                              const s3_acl_header* perm,
@@ -352,7 +353,7 @@ static int parse_grantee_str(const DoutPrefixProvider* dpp,
 
   if (strcasecmp(id_type.c_str(), "emailAddress") == 0) {
     ACLOwner owner;
-    ret = read_aclowner_by_email(dpp, null_yield, driver, id_val, owner);
+    ret = read_aclowner_by_email(dpp, y, driver, id_val, owner);
     if (ret < 0)
       return ret;
 
@@ -360,7 +361,7 @@ static int parse_grantee_str(const DoutPrefixProvider* dpp,
   } else if (strcasecmp(id_type.c_str(), "id") == 0) {
     ACLOwner owner;
     owner.id = parse_owner(id_val);
-    ret = read_owner_display_name(dpp, null_yield, driver,
+    ret = read_owner_display_name(dpp, y, driver,
                                   owner.id, owner.display_name);
     if (ret < 0)
       return ret;
@@ -379,7 +380,8 @@ static int parse_grantee_str(const DoutPrefixProvider* dpp,
   return 0;
 }
 
-static int parse_acl_header(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver,
+static int parse_acl_header(const DoutPrefixProvider* dpp,
+                            optional_yield y, rgw::sal::Driver* driver,
                             const RGWEnv& env, const s3_acl_header* perm,
                             RGWAccessControlList& acl)
 {
@@ -390,7 +392,7 @@ static int parse_acl_header(const DoutPrefixProvider* dpp, rgw::sal::Driver* dri
 
   for (std::string_view grantee : ceph::split(hacl, ",")) {
     ACLGrant grant;
-    int ret = parse_grantee_str(dpp, driver, std::string{grantee}, perm, grant);
+    int ret = parse_grantee_str(dpp, y, driver, std::string{grantee}, perm, grant);
     if (ret < 0)
       return ret;
 
@@ -685,6 +687,7 @@ int create_canned_acl(const ACLOwner& owner,
 }
 
 int create_policy_from_headers(const DoutPrefixProvider* dpp,
+                               optional_yield y,
                                rgw::sal::Driver* driver,
                                const ACLOwner& owner,
                                const RGWEnv& env,
@@ -694,7 +697,7 @@ int create_policy_from_headers(const DoutPrefixProvider* dpp,
   auto& acl = policy.get_acl();
 
   for (const s3_acl_header* p = acl_header_perms; p->rgw_perm; p++) {
-    int r = parse_acl_header(dpp, driver, env, p, acl);
+    int r = parse_acl_header(dpp, y, driver, env, p, acl);
     if (r < 0) {
       return r;
     }
index 2341461783fd4a1c05ba37903d8b0aa7d4e25f2f..22b34c21f455b47a11fe608dbec88f030f4f45a3 100644 (file)
@@ -39,6 +39,7 @@ int create_canned_acl(const ACLOwner& owner,
 
 /// Construct a policy from x-amz-grant-* request headers.
 int create_policy_from_headers(const DoutPrefixProvider* dpp,
+                               optional_yield y,
                                rgw::sal::Driver* driver,
                                const ACLOwner& owner,
                                const RGWEnv& env,
index e700886ca5b76cbbccdaf1cbc000779fb60c7640..a132f6a6f842be6cf617ed3954a6258f775f0bf3 100644 (file)
@@ -2370,7 +2370,7 @@ static int create_s3_policy(req_state *s, rgw::sal::Driver* driver,
     if (!s->canned_acl.empty())
       return -ERR_INVALID_REQUEST;
 
-    return rgw::s3::create_policy_from_headers(s, driver, owner,
+    return rgw::s3::create_policy_from_headers(s, s->yield, driver, owner,
                                                *s->info.env, policy);
   }