]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: cleanup for RGWDeleteObj::verify_permission() 25278/head
authorEnming.Zhang <zvampirem77@gmail.com>
Tue, 27 Nov 2018 11:41:56 +0000 (06:41 -0500)
committerEnming.Zhang <zvampirem77@gmail.com>
Tue, 27 Nov 2018 11:41:56 +0000 (06:41 -0500)
- if the 'Effect' field of user policy and bucket policy
  is set to 'Allow', RGWDeleteObj::verify_permission()
  should return 0 instead of true;

- as the same with bucket policy, if the 'Effect' field
  of user policy is set to 'Deny', RGWDeleteObj::verify_permission()
  should return -EACCES instead of false;

Signed-off-by: Enming.Zhang <zvampirem77@gmail.com>
src/rgw/rgw_op.cc

index d5d0211fa6396e9129e8729b5022fcd4ebf62da5..37e45ec0374d7752c6f0d6407f68ebe9e6dcc5d2 100644 (file)
@@ -4275,7 +4275,7 @@ int RGWDeleteObj::verify_permission()
                                               rgw::IAM::s3DeleteObjectVersion,
                                               ARN(s->bucket, s->object.name));
     if (usr_policy_res == Effect::Deny) {
-      return false;
+      return -EACCES;
     }
     auto r = s->iam_policy->eval(s->env, *s->auth.identity,
                                 s->object.instance.empty() ?
@@ -4283,11 +4283,11 @@ int RGWDeleteObj::verify_permission()
                                 rgw::IAM::s3DeleteObjectVersion,
                                 ARN(s->bucket, s->object.name));
     if (r == Effect::Allow)
-      return true;
+      return 0;
     else if (r == Effect::Deny)
       return -EACCES;
     else if (usr_policy_res == Effect::Allow)
-      return true;
+      return 0;
   }
 
   if (!verify_bucket_permission_no_policy(this, s, RGW_PERM_WRITE)) {