From: Seena Fallah Date: Mon, 19 Feb 2024 17:23:07 +0000 (+0100) Subject: rgw: return 404 on no bucket public access block X-Git-Tag: v19.1.0~236^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cfeccfc747b9a3e63e74628be2a6cfff63dda090;p=ceph.git rgw: return 404 on no bucket public access block Return 404 when there is no public access block on the bucket. Fixes: https://tracker.ceph.com/issues/64492 Signed-off-by: Seena Fallah (cherry picked from commit 146d4d98698d48dcbc0f036de0793e0a5f9bb8a6) --- diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 125d278018387..254e9721d2222 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -131,6 +131,7 @@ rgw_http_errors rgw_http_s3_errors({ { ERR_ZERO_IN_URL, {400, "InvalidRequest" }}, { ERR_NO_SUCH_TAG_SET, {404, "NoSuchTagSet"}}, { ERR_NO_SUCH_BUCKET_ENCRYPTION_CONFIGURATION, {404, "ServerSideEncryptionConfigurationNotFoundError"}}, + { ERR_NO_SUCH_PUBLIC_ACCESS_BLOCK_CONFIGURATION, {404, "NoSuchPublicAccessBlockConfiguration"}}, }); rgw_http_errors rgw_http_swift_errors({ diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index ea91859f5e682..ba3af8c879293 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -282,6 +282,7 @@ static inline const char* to_mime_type(const RGWFormat f) #define ERR_NO_SUCH_OBJECT_LOCK_CONFIGURATION 2046 #define ERR_INVALID_RETENTION_PERIOD 2047 #define ERR_NO_SUCH_BUCKET_ENCRYPTION_CONFIGURATION 2048 +#define ERR_NO_SUCH_PUBLIC_ACCESS_BLOCK_CONFIGURATION 2049 #define ERR_USER_SUSPENDED 2100 #define ERR_INTERNAL_ERROR 2200 #define ERR_NOT_IMPLEMENTED 2201 diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 445119dd4aee7..ab19a15dbc583 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -8997,7 +8997,10 @@ void RGWGetBucketPublicAccessBlock::execute(optional_yield y) aiter == attrs.end()) { ldpp_dout(this, 0) << "can't find bucket IAM POLICY attr bucket_name = " << s->bucket_name << dendl; - // return the default; + + op_ret = -ERR_NO_SUCH_PUBLIC_ACCESS_BLOCK_CONFIGURATION; + s->err.message = "The public access block configuration was not found"; + return; } else { bufferlist::const_iterator iter{&aiter->second};