]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix reading bucket policy in RGWBucket::get_policy()
authorYehuda Sadeh <yehuda@inktank.com>
Fri, 6 Dec 2013 19:07:09 +0000 (11:07 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 28 Jan 2014 20:28:44 +0000 (12:28 -0800)
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 <wei.m.gao@intel.com>
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 7a9a088d82d04f6105d72f6347673724ac16c9f8)

src/rgw/rgw_bucket.cc

index c8f528b9c5f068a42a024e1e0b6561f991434cf9..fee04dbba950fdd8aea8ccd7656e3be13417cf52 100644 (file)
@@ -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<string, bufferlist> attrs;
+  int ret = store->get_bucket_info(NULL, bucket.name, bucket_info, NULL, &attrs);
+  if (ret < 0) {
     return ret;
+  }
+
+  map<string, bufferlist>::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();