From 8812c4e958b154ca401c7257fd48ccaffe013639 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 27 Nov 2013 13:34:00 -0800 Subject: [PATCH] rgw: don't error out on empty owner when setting acls Fixes: #6892 Backport: dumpling, emperor s3cmd specifies empty owner field when trying to set acls on object / bucket. We errored out as it didn't match the current owner name, but with this change we ignore it. Signed-off-by: Yehuda Sadeh (cherry picked from commit 14cf4caff58cc2c535101d48c53afd54d8632104) --- src/rgw/rgw_acl_s3.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_acl_s3.cc b/src/rgw/rgw_acl_s3.cc index 6007d41077a0e..71c868266762a 100644 --- a/src/rgw/rgw_acl_s3.cc +++ b/src/rgw/rgw_acl_s3.cc @@ -454,8 +454,10 @@ int RGWAccessControlPolicy_S3::rebuild(RGWRados *store, ACLOwner *owner, RGWAcce return -EINVAL; ACLOwner *requested_owner = static_cast(find_first("Owner")); - if (requested_owner && requested_owner->get_id().compare(owner->get_id()) != 0) { - return -EPERM; + if (requested_owner) { + const string& requested_id = requested_owner->get_id(); + if (!requested_id.empty() && requested_id.compare(owner->get_id()) != 0) + return -EPERM; } RGWUserInfo owner_info; -- 2.39.5