From 7a9a088d82d04f6105d72f6347673724ac16c9f8 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 6 Dec 2013 11:07:09 -0800 Subject: [PATCH] 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 --- src/rgw/rgw_bucket.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 31afebe9ea33..5481b67ba452 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -722,11 +722,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(); -- 2.47.3