]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Check bucket GetBucketLocation in policy 18002/head
authorAdam C. Emerson <aemerson@redhat.com>
Wed, 27 Sep 2017 20:08:56 +0000 (16:08 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 27 Sep 2017 20:08:56 +0000 (16:08 -0400)
Add code to check s3:GetBucketLocation against bucket policy.

Fixes: http://tracker.ceph.com/issues/21582
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1493934
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_op.cc

index 39a5dee9b7158b292394870537b776fefa121307..1cfd62530d048f35c5f85da7541a70346cf1a005 100644 (file)
@@ -2304,11 +2304,16 @@ int RGWGetBucketLogging::verify_permission()
 
 int RGWGetBucketLocation::verify_permission()
 {
-  if (false == s->auth.identity->is_owner_of(s->bucket_owner.get_id())) {
-    return -EACCES;
+  if (s->iam_policy) {
+    if (s->iam_policy->eval(s->env, *s->auth.identity,
+                           rgw::IAM::s3GetBucketLocation,
+                           ARN(s->bucket)) == Effect::Allow) {
+      return 0;
+    }
+  } else if (s->auth.identity->is_owner_of(s->bucket_owner.get_id())) {
+    return 0;
   }
-
-  return 0;
+  return -EACCES;
 }
 
 int RGWCreateBucket::verify_permission()