From f32e26e909c3d56160e9a33d051d690fa4366bbd Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Thu, 6 Apr 2017 17:08:23 +0200 Subject: [PATCH] rgw: fix broken /crossdomain.xml, /info and /healthcheck of Swift API. Fixes: http://tracker.ceph.com/issues/19520 Signed-off-by: Radoslaw Zarzynski (cherry picked from commit fe2afd42aaf706d38d6ed611796a181ae9e02ae8) --- src/rgw/rgw_op.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index bcc7faf5495..7696e8c49a2 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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( - 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( + new RGWAccessControlPolicy_SWIFTAcct(s->cct)); + } s->bucket_acl = new RGWAccessControlPolicy_SWIFT(s->cct); } else { s->bucket_acl = new RGWAccessControlPolicy(s->cct); -- 2.47.3