Skip to content

Commit db36317

Browse files
authored
Merge pull request ceph#61421 from clwluvw/replication-conf
rgw: handle destination bucket as an ARN in ReplicationConfiguration Reviewed-by: Adam Emerson <[email protected]>
2 parents 2971b9e + b8f8932 commit db36317

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/rgw/rgw_rest_s3.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,8 +1318,14 @@ struct ReplicationConfiguration {
13181318
// Here we are sure that s->owner.id is of type rgw_user
13191319
const auto& tenant_owner = std::get_if<rgw_user>(&s->owner.id)->tenant;
13201320

1321+
auto dest_bk_arn = ARN::parse(destination.bucket);
1322+
if (!dest_bk_arn || dest_bk_arn->service != rgw::Service::s3 || dest_bk_arn->resource.empty()) {
1323+
s->err.message = "Invalid bucket ARN";
1324+
return -EINVAL;
1325+
}
1326+
13211327
rgw_bucket_key dest_bk(tenant_owner,
1322-
destination.bucket);
1328+
dest_bk_arn->resource);
13231329

13241330
if (source && !source->zone_names.empty()) {
13251331
pipe->source.zones = get_zone_ids_from_names(driver, source->zone_names);
@@ -1386,7 +1392,7 @@ struct ReplicationConfiguration {
13861392
}
13871393

13881394
if (pipe.dest.bucket) {
1389-
destination.bucket = pipe.dest.bucket->get_key();
1395+
destination.bucket = ARN(*pipe.dest.bucket).to_string();
13901396
}
13911397

13921398
filter.emplace();

0 commit comments

Comments
 (0)