]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw: fix swift anonymous access. 19194/head
authorMarcus Watts <mwatts@redhat.com>
Sun, 26 Nov 2017 23:43:23 +0000 (18:43 -0500)
committerMarcus Watts <mwatts@redhat.com>
Tue, 28 Nov 2017 04:26:51 +0000 (23:26 -0500)
With swift: when accessing a bucket anonymously (no credentials),
must set the bucket tenant appropriately in order to access the container.

Fixes: http://tracker.ceph.com/issues/22259
Signed-off-by: Marcus Watts <mwatts@redhat.com>
src/rgw/rgw_rest_swift.cc

index 1532d1eeff54d662f86d70e1698670c60688e95c..574537f4df5fc16ed94dbe09d34f1f9125019c5f 100644 (file)
@@ -1572,6 +1572,9 @@ int RGWHandler_REST_SWIFT::authorize()
     /* anonymous access */
     rgw_get_anon_user(*(s->user));
     s->perm_mask = RGW_PERM_FULL_CONTROL;
+    if (! s->account_name.empty()) {
+      s->bucket_tenant = s->account_name;
+    }
     return 0;
   }
 
@@ -1606,7 +1609,9 @@ int RGWHandler_REST_SWIFT::postauth_init()
   struct req_init_state* t = &s->init_state;
 
   /* XXX Stub this until Swift Auth sets account into URL. */
-  s->bucket_tenant = s->user->user_id.tenant;
+  if (s->bucket_tenant.empty()) {
+    s->bucket_tenant = s->user->user_id.tenant;
+  }
   s->bucket_name = t->url_bucket;
 
   dout(10) << "s->object=" <<