summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil <sage@redhat.com>2014-08-28 21:42:00 +0200
committerSage Weil <sage@redhat.com>2014-08-28 21:42:00 +0200
commit228801173258c06816dd865ae02dd60aa73d3230 (patch)
tree9491ba25a35fd837b4c4b8d6eccc92a8632c6f49
parentMerge pull request #2348 from athanatos/wip-9054 (diff)
parentrgw: don't try to authenticate a CORS preflight request (diff)
downloadceph-228801173258c06816dd865ae02dd60aa73d3230.tar.xz
ceph-228801173258c06816dd865ae02dd60aa73d3230.zip
Merge pull request #2350 from ceph/wip-8718
rgw: don't try to authenticate a CORS preflight request Reviewed-by: Sage Weil <sage@redhat.com>
-rw-r--r--src/rgw/rgw_rest_s3.cc14
-rw-r--r--src/rgw/rgw_rest_swift.cc3
2 files changed, 14 insertions, 3 deletions
diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc
index 79de0732a2a..354ae7eaaf6 100644
--- a/src/rgw/rgw_rest_s3.cc
+++ b/src/rgw/rgw_rest_s3.cc
@@ -2050,6 +2050,12 @@ int RGW_Auth_S3_Keystone_ValidateToken::validate_s3token(const string& auth_id,
return 0;
}
+static void init_anon_user(struct req_state *s)
+{
+ rgw_get_anon_user(s->user);
+ s->perm_mask = RGW_PERM_FULL_CONTROL;
+}
+
/*
* verify that a signed request comes from the keyholder
* by checking the signature against our locally-computed version
@@ -2070,6 +2076,11 @@ int RGW_Auth_S3::authorize(RGWRados *store, struct req_state *s)
return -EPERM;
}
+ if (s->op == OP_OPTIONS) {
+ init_anon_user(s);
+ return 0;
+ }
+
if (!s->http_auth || !(*s->http_auth)) {
auth_id = s->info.args.get("AWSAccessKeyId");
if (auth_id.size()) {
@@ -2083,8 +2094,7 @@ int RGW_Auth_S3::authorize(RGWRados *store, struct req_state *s)
qsr = true;
} else {
/* anonymous access */
- rgw_get_anon_user(s->user);
- s->perm_mask = RGW_PERM_FULL_CONTROL;
+ init_anon_user(s);
return 0;
}
} else {
diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc
index ed8678d93d4..e1cfedf6d46 100644
--- a/src/rgw/rgw_rest_swift.cc
+++ b/src/rgw/rgw_rest_swift.cc
@@ -778,7 +778,8 @@ RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_options()
int RGWHandler_ObjStore_SWIFT::authorize()
{
- if (!s->os_auth_token && s->info.args.get("temp_url_sig").empty()) {
+ if ((!s->os_auth_token && s->info.args.get("temp_url_sig").empty()) ||
+ (s->op == OP_OPTIONS)) {
/* anonymous access */
rgw_get_anon_user(s->user);
s->perm_mask = RGW_PERM_FULL_CONTROL;