]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW - Fix TempURL user handling 39876/head
authorDaniel Gryniewicz <dang@redhat.com>
Thu, 4 Mar 2021 16:18:54 +0000 (11:18 -0500)
committerDaniel Gryniewicz <dang@redhat.com>
Fri, 5 Mar 2021 20:11:11 +0000 (15:11 -0500)
Zipper brok user handling for TempURL, missing the fallback to
untenentaed UID.

Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
src/rgw/rgw_swift_auth.cc

index 81e5c009303171d686735bf790f4d7da489d4c7f..e174cac02cf4a0307ffdd3242361fdea0d04b67b 100644 (file)
@@ -85,16 +85,24 @@ void TempURLEngine::get_owner_info(const DoutPrefixProvider* dpp, const req_stat
    * the access would be limited to accounts with empty tenant. */
   string bucket_tenant;
   if (!s->account_name.empty()) {
+    bool found = false;
     std::unique_ptr<rgw::sal::RGWUser> user;
 
     rgw_user uid(s->account_name);
     if (uid.tenant.empty()) {
-      uid.tenant = uid.id;
+      rgw_user tenanted_uid(uid.id, uid.id);
+      user = store->get_user(tenanted_uid);
+      if (user->load_by_id(dpp, s->yield) >= 0) {
+       /* Succeeded */
+       found = true;
+      }
     }
 
-    user = store->get_user(uid);
-    if (user->load_by_id(dpp, s->yield) < 0) {
-      throw -EPERM;
+    if (!found) {
+      user = store->get_user(uid);
+      if (user->load_by_id(dpp, s->yield) < 0) {
+       throw -EPERM;
+      }
     }
 
     bucket_tenant = user->get_tenant();
@@ -117,6 +125,8 @@ void TempURLEngine::get_owner_info(const DoutPrefixProvider* dpp, const req_stat
   if (user->load_by_id(dpp, s->yield) < 0) {
     throw -EPERM;
   }
+
+  owner_info = user->get_info();
 }
 
 std::string TempURLEngine::convert_from_iso8601(std::string expires) const