]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix reading bucket policy in RGWBucket::get_policy() 908/head
authorYehuda Sadeh <yehuda@inktank.com>
Fri, 6 Dec 2013 19:07:09 +0000 (11:07 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Fri, 6 Dec 2013 19:10:21 +0000 (11:10 -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>
src/rgw/rgw_bucket.cc

index 31afebe9ea33d98cfa9e325cc7743b6f496b5c7b..5481b67ba4527e9bbc8471e7d236dd9b4bd045ed 100644 (file)
@@ -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<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();