]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: use existing s->bucket in s3 website retarget()
authorCasey Bodley <cbodley@redhat.com>
Thu, 19 Aug 2021 19:01:08 +0000 (15:01 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 20 Aug 2021 19:56:09 +0000 (15:56 -0400)
we should have already looked up s->bucket and s->object during auth

since s->object may store a raw pointer to s->bucket before this,
overwriting s->bucket here would leave a dangling pointer and Object's
operator<<() would crash

Fixes: https://tracker.ceph.com/issues/51491
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_rest_s3.cc

index 84adbf01dc1c08c72a1f206fb63c1eb54218665c..1a561d9160daf0f79452e77d7f912398d832f52a 100644 (file)
@@ -4981,14 +4981,6 @@ int RGWHandler_REST_S3Website::retarget(RGWOp* op, RGWOp** new_op, optional_yiel
   if (!(s->prot_flags & RGW_REST_WEBSITE))
     return 0;
 
-  int ret = store->get_bucket(s, nullptr, s->bucket_tenant, s->bucket_name, &s->bucket, y);
-  if (ret < 0) {
-      // TODO-FUTURE: if the bucket does not exist, maybe expose it here?
-      return -ERR_NO_SUCH_BUCKET;
-  }
-
-  s->bucket_attrs = s->bucket->get_attrs();
-
   if (!s->bucket->get_info().has_website) {
       // TODO-FUTURE: if the bucket has no WebsiteConfig, expose it here
       return -ERR_NO_SUCH_WEBSITE_CONFIGURATION;