Skip to content

Commit

Permalink
rgw: fix the bug that the s3cmd abortmp operation may delete the buck…
Browse files Browse the repository at this point in the history
…et by mistake
  • Loading branch information
qwer506 committed Jan 1, 2021
1 parent d2d1c23 commit cfcb5cc
Showing 1 changed file with 26 additions and 30 deletions.
56 changes: 26 additions & 30 deletions src/rgw/rgw_rest_s3.cc
Expand Up @@ -4427,38 +4427,34 @@ RGWOp *RGWHandler_REST_Bucket_S3::op_put()

RGWOp *RGWHandler_REST_Bucket_S3::op_delete()
{
if (s->info.args.sub_resource_exists("logging") ||
s->info.args.sub_resource_exists("encryption"))
return nullptr;

if (is_tagging_op()) {
return new RGWDeleteBucketTags_ObjStore_S3;
} else if (is_cors_op()) {
return new RGWDeleteCORS_ObjStore_S3;
} else if(is_lc_op()) {
return new RGWDeleteLC_ObjStore_S3;
} else if(is_policy_op()) {
return new RGWDeleteBucketPolicy;
} else if (is_notification_op()) {
return RGWHandler_REST_PSNotifs_S3::create_delete_op();
} else if (is_replication_op()) {
return new RGWDeleteBucketReplication_ObjStore_S3;
} else if (is_block_public_access_op()) {
return new RGWDeleteBucketPublicAccessBlock;
}

if (s->info.args.sub_resource_exists("website")) {
if (!s->cct->_conf->rgw_enable_static_website) {
return NULL;
if (s->info.args.get_num_params()) {
if (is_tagging_op()) {
return new RGWDeleteBucketTags_ObjStore_S3;
} else if (is_cors_op()) {
return new RGWDeleteCORS_ObjStore_S3;
} else if(is_lc_op()) {
return new RGWDeleteLC_ObjStore_S3;
} else if(is_policy_op()) {
return new RGWDeleteBucketPolicy;
} else if (is_notification_op()) {
return RGWHandler_REST_PSNotifs_S3::create_delete_op();
} else if (is_replication_op()) {
return new RGWDeleteBucketReplication_ObjStore_S3;
} else if (is_block_public_access_op()) {
return new RGWDeleteBucketPublicAccessBlock;
} else if (s->info.args.sub_resource_exists("website")) {
if (!s->cct->_conf->rgw_enable_static_website) {
return NULL;
}
return new RGWDeleteBucketWebsite_ObjStore_S3;
} else if (s->info.args.exists("mdsearch")) {
return new RGWDelBucketMetaSearch_ObjStore_S3;
} else {
return nullptr;
}
return new RGWDeleteBucketWebsite_ObjStore_S3;
}

if (s->info.args.exists("mdsearch")) {
return new RGWDelBucketMetaSearch_ObjStore_S3;
} else {
return new RGWDeleteBucket_ObjStore_S3;
}

return new RGWDeleteBucket_ObjStore_S3;
}

RGWOp *RGWHandler_REST_Bucket_S3::op_post()
Expand Down

0 comments on commit cfcb5cc

Please sign in to comment.