From 3f18c2576ecd5c60f4ed5dc202a647f77e5213b5 Mon Sep 17 00:00:00 2001 From: Daniel Gryniewicz Date: Thu, 4 Mar 2021 11:18:54 -0500 Subject: [PATCH] RGW - Fix TempURL user handling Zipper brok user handling for TempURL, missing the fallback to untenentaed UID. Signed-off-by: Daniel Gryniewicz --- src/rgw/rgw_swift_auth.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_swift_auth.cc b/src/rgw/rgw_swift_auth.cc index 81e5c0093031..e174cac02cf4 100644 --- a/src/rgw/rgw_swift_auth.cc +++ b/src/rgw/rgw_swift_auth.cc @@ -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 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 -- 2.47.3