]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix broken /crossdomain.xml, /info and /healthcheck of Swift API. 16168/head
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Thu, 6 Apr 2017 15:08:23 +0000 (17:08 +0200)
committerNathan Cutler <ncutler@suse.com>
Thu, 6 Jul 2017 10:20:59 +0000 (12:20 +0200)
Fixes: http://tracker.ceph.com/issues/19520
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
(cherry picked from commit fe2afd42aaf706d38d6ed611796a181ae9e02ae8)

src/rgw/rgw_op.cc

index bcc7faf54953398976ff69e8e1be7e0382d98260..7696e8c49a216858a2ac43635111e5e8f291a1ba 100644 (file)
@@ -368,8 +368,13 @@ int rgw_build_bucket_policies(RGWRados* store, struct req_state* s)
   if(s->dialect.compare("s3") == 0) {
     s->bucket_acl = new RGWAccessControlPolicy_S3(s->cct);
   } else if(s->dialect.compare("swift")  == 0) {
-    s->user_acl = std::unique_ptr<RGWAccessControlPolicy>(
-        new RGWAccessControlPolicy_SWIFTAcct(s->cct));
+    /* We aren't allocating the account policy for those operations using
+     * the Swift's infrastructure that don't really need req_state::user.
+     * Typical example here is the implementation of /info. */
+    if (!s->user->user_id.empty()) {
+      s->user_acl = std::unique_ptr<RGWAccessControlPolicy>(
+          new RGWAccessControlPolicy_SWIFTAcct(s->cct));
+    }
     s->bucket_acl = new RGWAccessControlPolicy_SWIFT(s->cct);
   } else {
     s->bucket_acl = new RGWAccessControlPolicy(s->cct);