From: Yehuda Sadeh Date: Fri, 6 Dec 2013 19:07:09 +0000 (-0800) Subject: rgw: fix reading bucket policy in RGWBucket::get_policy() X-Git-Tag: v0.67.6~25 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a5739e3903f8c30c8168199413818922b4a29bad;p=ceph.git rgw: fix reading bucket policy in RGWBucket::get_policy() Fixes: 6940 Backport: dumpling, emperor We changed the way we keep the bucket policy, and we shouldn't try to access the bucket object directly. This had changed when we added the bucket instance object around dumpling. Reported-by: Gao, Wei M Signed-off-by: Yehuda Sadeh (cherry picked from commit 7a9a088d82d04f6105d72f6347673724ac16c9f8) --- diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index c8f528b9c5f0..fee04dbba950 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -732,11 +732,19 @@ int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, ostream& o) std::string object_name = op_state.get_object_name(); rgw_bucket bucket = op_state.get_bucket(); - bufferlist bl; - rgw_obj obj(bucket, object_name); - int ret = store->get_attr(NULL, obj, RGW_ATTR_ACL, bl); - if (ret < 0) + RGWBucketInfo bucket_info; + map attrs; + int ret = store->get_bucket_info(NULL, bucket.name, bucket_info, NULL, &attrs); + if (ret < 0) { return ret; + } + + map::iterator aiter = attrs.find(RGW_ATTR_ACL); + if (aiter == attrs.end()) { + return -ENOENT; + } + + bufferlist& bl = aiter->second; RGWAccessControlPolicy_S3 policy(g_ceph_context); bufferlist::iterator iter = bl.begin();