diff --git a/cmd/admin-bucket-handlers.go b/cmd/admin-bucket-handlers.go index ef06ce50b..b93bea72b 100644 --- a/cmd/admin-bucket-handlers.go +++ b/cmd/admin-bucket-handlers.go @@ -228,8 +228,10 @@ func (a adminAPIHandlers) SetRemoteTargetHandler(w http.ResponseWriter, r *http. for _, op := range ops { switch op { case madmin.CredentialsUpdateType: - tgt.Credentials = target.Credentials - tgt.TargetBucket = target.TargetBucket + if !globalSiteReplicationSys.isEnabled() { + tgt.Credentials = target.Credentials + tgt.TargetBucket = target.TargetBucket + } tgt.Secure = target.Secure tgt.Endpoint = target.Endpoint case madmin.SyncUpdateType: diff --git a/cmd/bucket-targets.go b/cmd/bucket-targets.go index e263fb5cc..19b44effd 100644 --- a/cmd/bucket-targets.go +++ b/cmd/bucket-targets.go @@ -256,6 +256,10 @@ func (sys *BucketTargetSys) SetTarget(ctx context.Context, bucket string, tgt *m found = true continue } + // fail if endpoint is already present in list of targets and not a matching ARN + if t.Endpoint == tgt.Endpoint { + return BucketRemoteAlreadyExists{Bucket: t.TargetBucket} + } } newtgts[idx] = t }