From: Radoslaw Zarzynski Date: Sat, 15 Apr 2017 22:03:56 +0000 (+0200) Subject: rgw: clean up the AWSv4 completion calls across RGWOps. X-Git-Tag: v12.1.0~155^2~49 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=79b826e54c93f65ed8b01b962fbf783f60c157b4;p=ceph.git rgw: clean up the AWSv4 completion calls across RGWOps. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 0118aca0c323..1ef143bed551 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -3293,30 +3293,11 @@ void RGWPutObj::execute() perfcounter->inc(l_rgw_put_b, s->obj_size); - if (s->aws4_auth_needs_complete) { - - /* complete aws4 auth */ - - op_ret = RGW_Auth_S3::authorize_aws4_auth_complete(store, s); - if (op_ret) { - goto done; - } - - s->aws4_auth_needs_complete = false; - - /* verify signature */ - - if (s->aws4_auth->signature != s->aws4_auth->new_signature) { - op_ret = -ERR_SIGNATURE_NO_MATCH; - ldout(s->cct, 20) << "delayed aws4 auth failed" << dendl; - goto done; - } - - /* authorization ok */ - - dout(10) << "v4 auth ok" << dendl; - + op_ret = do_aws4_auth_completion(); + if (op_ret < 0) { + goto done; } + op_ret = store->check_quota(s->bucket_owner.get_id(), s->bucket, user_quota, bucket_quota, s->obj_size); if (op_ret < 0) { diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 01c3a52609d7..b46779813992 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -791,11 +791,9 @@ int RGWSetBucketVersioning_ObjStore_S3::get_params() auto data_deleter = std::unique_ptr{data, free}; - if (s->aws4_auth_needs_complete) { - int ret_auth = do_aws4_auth_completion(); - if (ret_auth < 0) { - return ret_auth; - } + r = do_aws4_auth_completion(); + if (r < 0) { + return r; } RGWSetBucketVersioningParser parser; @@ -843,11 +841,9 @@ int RGWSetBucketWebsite_ObjStore_S3::get_params() auto data_deleter = std::unique_ptr{data, free}; - if (s->aws4_auth_needs_complete) { - int ret_auth = do_aws4_auth_completion(); - if (ret_auth < 0) { - return ret_auth; - } + r = do_aws4_auth_completion(); + if (r < 0) { + return r; } RGWXMLDecoder::XMLParser parser; @@ -1014,11 +1010,9 @@ int RGWCreateBucket_ObjStore_S3::get_params() auto data_deleter = std::unique_ptr{data, free}; - if (s->aws4_auth_needs_complete) { - int ret_auth = do_aws4_auth_completion(); - if (ret_auth < 0) { - return ret_auth; - } + const int auth_ret = do_aws4_auth_completion(); + if (auth_ret < 0) { + return auth_ret; } bufferptr in_ptr(data, len); @@ -1330,20 +1324,13 @@ int RGWPutObj_ObjStore_S3::validate_and_unwrap_available_aws4_chunked_data(buffe int RGWPutObj_ObjStore_S3::get_data(bufferlist& bl) { int ret = RGWPutObj_ObjStore::get_data(bl); - if (ret < 0) - s->aws4_auth_needs_complete = false; - - int ret_auth; - - if (s->aws4_auth_streaming_mode && ret > 0) { - ret_auth = validate_and_unwrap_available_aws4_chunked_data(bl, s->aws4_auth->bl); + if (ret > 0 && s->aws4_auth_streaming_mode) { + int ret_auth = validate_and_unwrap_available_aws4_chunked_data(bl, s->aws4_auth->bl); if (ret_auth < 0) { return ret_auth; } - } - - if ((ret == 0) && s->aws4_auth_needs_complete) { - ret_auth = do_aws4_auth_completion(); + } else if (ret == 0) { + int ret_auth = do_aws4_auth_completion(); if (ret_auth < 0) { return ret_auth; } @@ -2209,10 +2196,8 @@ void RGWGetACLs_ObjStore_S3::send_response() int RGWPutACLs_ObjStore_S3::get_params() { int ret = RGWPutACLs_ObjStore::get_params(); - if (ret < 0) - s->aws4_auth_needs_complete = false; - if (s->aws4_auth_needs_complete) { - int ret_auth = do_aws4_auth_completion(); + if (ret >= 0) { + const int ret_auth = do_aws4_auth_completion(); if (ret_auth < 0) { return ret_auth; } @@ -2350,11 +2335,9 @@ int RGWPutCORS_ObjStore_S3::get_params() auto data_deleter = std::unique_ptr{data, free}; - if (s->aws4_auth_needs_complete) { - r = do_aws4_auth_completion(); - if (r < 0) { - return r; - } + r = do_aws4_auth_completion(); + if (r < 0) { + return r; } if (!parser.init()) { @@ -2559,13 +2542,7 @@ int RGWCompleteMultipart_ObjStore_S3::get_params() return ret; } - if (s->aws4_auth_needs_complete) { - int ret_auth = do_aws4_auth_completion(); - if (ret_auth < 0) { - return ret_auth; - } - } - return 0; + return do_aws4_auth_completion(); } void RGWCompleteMultipart_ObjStore_S3::send_response() @@ -2729,13 +2706,7 @@ int RGWDeleteMultiObj_ObjStore_S3::get_params() return ret; } - if (s->aws4_auth_needs_complete) { - int ret_auth = do_aws4_auth_completion(); - if (ret_auth < 0) { - return ret_auth; - } - } - return 0; + return do_aws4_auth_completion(); } void RGWDeleteMultiObj_ObjStore_S3::send_status()