]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't try to read bucket's policy if it doesn't exist 1266/head
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 19 Feb 2014 02:14:40 +0000 (18:14 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Wed, 19 Feb 2014 02:42:55 +0000 (18:42 -0800)
It's going to fail anyway, just build a default policy.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_op.cc

index 98b6fadc9c10f0a0c6544671080a92ce492df1c6..c4c89447bd434e4810f157babce1d186c69ff9ef 100644 (file)
@@ -358,9 +358,13 @@ static int rgw_build_policies(RGWRados *store, struct req_state *s, bool only_bu
     }
     s->bucket = s->bucket_info.bucket;
 
-    string no_obj;
-    RGWAccessControlPolicy bucket_acl(s->cct);
-    ret = read_policy(store, s, s->bucket_info, s->bucket_attrs, s->bucket_acl, s->bucket, no_obj);
+    if (s->bucket_exists) {
+      string no_obj;
+      ret = read_policy(store, s, s->bucket_info, s->bucket_attrs, s->bucket_acl, s->bucket, no_obj);
+    } else {
+      s->bucket_acl->create_default(s->user.user_id, s->user.display_name);
+      ret = -ERR_NO_SUCH_BUCKET;
+    }
 
     s->bucket_owner = s->bucket_acl->get_owner();