]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: treat lack of swift token as anonymous user access
authorYehuda Sadeh <yehuda@inktank.com>
Fri, 30 Nov 2012 00:04:41 +0000 (16:04 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Fri, 30 Nov 2012 00:06:11 +0000 (16:06 -0800)
Fixes: 3534
If a swift token hasn't been provided, set user as anonymous.

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

index ee55aed325426d26289fa6cdab666d2ee206aae0..3a7007b6df8b26d043769db243a8f53b7f0a15a7 100644 (file)
@@ -612,6 +612,13 @@ RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_copy()
 
 int RGWHandler_ObjStore_SWIFT::authorize()
 {
+  if (!s->os_auth_token) {
+    /* anonymous access */
+    rgw_get_anon_user(s->user);
+    s->perm_mask = RGW_PERM_FULL_CONTROL;
+    return 0;
+  }
+
   bool authorized = rgw_swift->verify_swift_token(store, s);
   if (!authorized)
     return -EPERM;