From 9ce3bcc12a667d83efa5e22bc2abb852b8c2a15f Mon Sep 17 00:00:00 2001 From: Vedansh Bhartia Date: Sun, 16 Jul 2023 10:22:42 +0530 Subject: [PATCH] rgw: When finding bucket owner info, handle account name being empty Signed-off-by: Vedansh Bhartia --- src/rgw/rgw_rest_swift.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index dc28b77090a..11e7c647c7d 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -2081,6 +2081,7 @@ void RGWFormPost::get_owner_info(const req_state* const s, const string& bucket_name = s->init_state.url_bucket; std::unique_ptr user; + std::string bucket_tenant; /* TempURL in Formpost only requires that bucket name is specified. */ if (bucket_name.empty()) { @@ -2108,11 +2109,13 @@ void RGWFormPost::get_owner_info(const req_state* const s, throw -EPERM; } } + + bucket_tenant = user->get_tenant(); } /* Need to get user info of bucket owner. */ std::unique_ptr bucket; - int ret = driver->get_bucket(s, user.get(), user->get_tenant(), bucket_name, &bucket, s->yield); + int ret = driver->get_bucket(s, user.get(), bucket_tenant, bucket_name, &bucket, s->yield); if (ret < 0) { throw ret; } -- 2.39.5