]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use existing s->bucket in s3 website retarget() 43777/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 19 Aug 2021 19:01:08 +0000 (15:01 -0400)
committerCory Snyder <csnyder@iland.com>
Tue, 2 Nov 2021 16:58:04 +0000 (12:58 -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>
(cherry picked from commit 2598e062d04d7fe4477aa096c19ebebfa77d19ea)

src/rgw/rgw_rest_s3.cc

index 33ec35c1cfa85be8e8101e79690f13de3c34f5d2..eaf407735e1e4218afdf1c307d120ee4e67f1a12 100644 (file)
@@ -4944,14 +4944,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;