mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +00:00
rgw: implement missing handlers for aws4 signatures
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
parent
f851cbcde7
commit
b052b0d269
@ -1015,7 +1015,7 @@ int RGWPutACLs_ObjStore::get_params()
|
||||
return op_ret;
|
||||
}
|
||||
int read_len;
|
||||
int r = s->cio->read(data, cl, &read_len);
|
||||
int r = s->cio->read(data, cl, &read_len, s->aws4_auth_needs_complete);
|
||||
len = read_len;
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -1039,7 +1039,7 @@ static int read_all_chunked_input(req_state *s, char **pdata, int *plen, int max
|
||||
|
||||
int read_len = 0, len = 0;
|
||||
do {
|
||||
int r = s->cio->read(data + len, need_to_read, &read_len);
|
||||
int r = s->cio->read(data + len, need_to_read, &read_len, s->aws4_auth_needs_complete);
|
||||
if (r < 0) {
|
||||
free(data);
|
||||
return r;
|
||||
@ -1092,7 +1092,7 @@ int rgw_rest_read_all_input(struct req_state *s, char **pdata, int *plen, int ma
|
||||
if (!data) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
int ret = s->cio->read(data, cl, &len);
|
||||
int ret = s->cio->read(data, cl, &len, s->aws4_auth_needs_complete);
|
||||
if (ret < 0) {
|
||||
free(data);
|
||||
return ret;
|
||||
@ -1198,7 +1198,7 @@ int RGWDeleteMultiObj_ObjStore::get_params()
|
||||
return op_ret;
|
||||
}
|
||||
int read_len;
|
||||
op_ret = s->cio->read(data, cl, &read_len);
|
||||
op_ret = s->cio->read(data, cl, &read_len, s->aws4_auth_needs_complete);
|
||||
len = read_len;
|
||||
if (op_ret < 0)
|
||||
return op_ret;
|
||||
|
@ -283,7 +283,7 @@ public:
|
||||
RGWCompleteMultipart_ObjStore() {}
|
||||
~RGWCompleteMultipart_ObjStore() {}
|
||||
|
||||
int get_params();
|
||||
virtual int get_params();
|
||||
};
|
||||
|
||||
class RGWAbortMultipart_ObjStore : public RGWAbortMultipart {
|
||||
@ -319,7 +319,7 @@ public:
|
||||
RGWDeleteMultiObj_ObjStore() {}
|
||||
~RGWDeleteMultiObj_ObjStore() {}
|
||||
|
||||
int get_params();
|
||||
virtual int get_params();
|
||||
};
|
||||
|
||||
class RGWRESTOp : public RGWOp {
|
||||
|
@ -157,6 +157,13 @@ void RGWOp_Metadata_Put::execute() {
|
||||
if (http_ret < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (s->aws4_auth_needs_complete) {
|
||||
http_ret = do_aws4_auth_completion();
|
||||
if (http_ret < 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
frame_metadata_key(s, metadata_key);
|
||||
|
||||
|
@ -509,6 +509,13 @@ int RGWSetBucketVersioning_ObjStore_S3::get_params()
|
||||
return r;
|
||||
}
|
||||
|
||||
if (s->aws4_auth_needs_complete) {
|
||||
int ret_auth = do_aws4_auth_completion();
|
||||
if (ret_auth < 0) {
|
||||
return ret_auth;
|
||||
}
|
||||
}
|
||||
|
||||
RGWSetBucketVersioningParser parser;
|
||||
|
||||
if (!parser.init()) {
|
||||
@ -712,6 +719,13 @@ int RGWCreateBucket_ObjStore_S3::get_params()
|
||||
if ((op_ret < 0) && (op_ret != -ERR_LENGTH_REQUIRED))
|
||||
return op_ret;
|
||||
|
||||
if (s->aws4_auth_needs_complete) {
|
||||
int ret_auth = do_aws4_auth_completion();
|
||||
if (ret_auth < 0) {
|
||||
return ret_auth;
|
||||
}
|
||||
}
|
||||
|
||||
bufferptr in_ptr(data, len);
|
||||
in_data.append(in_ptr);
|
||||
|
||||
@ -819,8 +833,9 @@ int RGWPutObj_ObjStore_S3::get_data(bufferlist& bl)
|
||||
s->aws4_auth_needs_complete = false;
|
||||
if ((ret == 0) && s->aws4_auth_needs_complete) {
|
||||
int ret_auth = do_aws4_auth_completion();
|
||||
if (ret_auth)
|
||||
if (ret_auth < 0) {
|
||||
return ret_auth;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1720,8 +1735,9 @@ int RGWPutACLs_ObjStore_S3::get_params()
|
||||
s->aws4_auth_needs_complete = false;
|
||||
if (s->aws4_auth_needs_complete) {
|
||||
int ret_auth = do_aws4_auth_completion();
|
||||
if (ret_auth)
|
||||
if (ret_auth < 0) {
|
||||
return ret_auth;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1794,7 +1810,7 @@ int RGWPutCORS_ObjStore_S3::get_params()
|
||||
goto done_err;
|
||||
}
|
||||
int read_len;
|
||||
r = s->cio->read(data, cl, &read_len);
|
||||
r = s->cio->read(data, cl, &read_len, s->aws4_auth_needs_complete);
|
||||
len = read_len;
|
||||
if (r < 0)
|
||||
goto done_err;
|
||||
@ -1803,6 +1819,13 @@ int RGWPutCORS_ObjStore_S3::get_params()
|
||||
len = 0;
|
||||
}
|
||||
|
||||
if (s->aws4_auth_needs_complete) {
|
||||
int ret_auth = do_aws4_auth_completion();
|
||||
if (ret_auth < 0) {
|
||||
return ret_auth;
|
||||
}
|
||||
}
|
||||
|
||||
if (!parser.init()) {
|
||||
r = -EINVAL;
|
||||
goto done_err;
|
||||
@ -1994,6 +2017,22 @@ void RGWInitMultipart_ObjStore_S3::send_response()
|
||||
}
|
||||
}
|
||||
|
||||
int RGWCompleteMultipart_ObjStore_S3::get_params()
|
||||
{
|
||||
int ret = RGWCompleteMultipart_ObjStore::get_params();
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (s->aws4_auth_needs_complete) {
|
||||
int ret_auth = do_aws4_auth_completion();
|
||||
if (ret_auth < 0) {
|
||||
return ret_auth;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGWCompleteMultipart_ObjStore_S3::send_response()
|
||||
{
|
||||
if (op_ret)
|
||||
@ -2157,6 +2196,22 @@ void RGWListBucketMultiparts_ObjStore_S3::send_response()
|
||||
rgw_flush_formatter_and_reset(s, s->formatter);
|
||||
}
|
||||
|
||||
int RGWDeleteMultiObj_ObjStore_S3::get_params()
|
||||
{
|
||||
int ret = RGWDeleteMultiObj_ObjStore::get_params();
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (s->aws4_auth_needs_complete) {
|
||||
int ret_auth = do_aws4_auth_completion();
|
||||
if (ret_auth < 0) {
|
||||
return ret_auth;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGWDeleteMultiObj_ObjStore_S3::send_status()
|
||||
{
|
||||
if (! status_dumped) {
|
||||
@ -3121,13 +3176,14 @@ int RGW_Auth_S3::authorize_v4(RGWRados *store, struct req_state *s)
|
||||
|
||||
switch (s->op_type)
|
||||
{
|
||||
case RGW_OP_CREATE_BUCKET:
|
||||
case RGW_OP_PUT_OBJ:
|
||||
case RGW_OP_PUT_ACLS:
|
||||
/* ops requiring aws4 completion but not implemented yet */
|
||||
//case RGW_OP_PUT_CORS:
|
||||
//case RGW_OP_COMPLETE_MULTIPART:
|
||||
//case RGW_OP_SET_BUCKET_VERSIONING:
|
||||
//case RGW_OP_DELETE_MULTI_OBJ:
|
||||
case RGW_OP_PUT_CORS:
|
||||
case RGW_OP_COMPLETE_MULTIPART:
|
||||
case RGW_OP_SET_BUCKET_VERSIONING:
|
||||
case RGW_OP_DELETE_MULTI_OBJ:
|
||||
case RGW_OP_ADMIN_SET_METADATA:
|
||||
break;
|
||||
default:
|
||||
dout(10) << "ERROR: AWS4 completion for this operation NOT IMPLEMENTED" << dendl;
|
||||
|
@ -293,6 +293,7 @@ public:
|
||||
RGWCompleteMultipart_ObjStore_S3() {}
|
||||
~RGWCompleteMultipart_ObjStore_S3() {}
|
||||
|
||||
int get_params();
|
||||
void send_response();
|
||||
};
|
||||
|
||||
@ -327,6 +328,7 @@ public:
|
||||
RGWDeleteMultiObj_ObjStore_S3() {}
|
||||
~RGWDeleteMultiObj_ObjStore_S3() {}
|
||||
|
||||
int get_params();
|
||||
void send_status();
|
||||
void begin_response();
|
||||
void send_partial_response(rgw_obj_key& key, bool delete_marker,
|
||||
|
Loading…
Reference in New Issue
Block a user