]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: raise error on not implemented AWS4 completions
authorJavier M. Mellid <jmunhoz@igalia.com>
Thu, 14 Jan 2016 13:14:38 +0000 (14:14 +0100)
committerJavier M. Mellid <jmunhoz@igalia.com>
Sat, 13 Feb 2016 12:49:42 +0000 (12:49 +0000)
Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
src/rgw/rgw_common.h
src/rgw/rgw_main.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest_s3.cc

index 4e7e3a152185be4708fbf6dd9cec7d949934ee71..44f94c514ae02b5efef180fe2e92d28bb872d361 100644 (file)
@@ -372,6 +372,40 @@ enum http_op {
   OP_UNKNOWN,
 };
 
+enum RGWOpType {
+  RGW_OP_UNKNOWN = 0,
+  RGW_OP_GET_OBJ,
+  RGW_OP_LIST_BUCKETS,
+  RGW_OP_STAT_ACCOUNT,
+  RGW_OP_LIST_BUCKET,
+  RGW_OP_GET_BUCKET_LOGGING,
+  RGW_OP_GET_BUCKET_VERSIONING,
+  RGW_OP_SET_BUCKET_VERSIONING,
+  RGW_OP_STAT_BUCKET,
+  RGW_OP_CREATE_BUCKET,
+  RGW_OP_DELETE_BUCKET,
+  RGW_OP_PUT_OBJ,
+  RGW_OP_POST_OBJ,
+  RGW_OP_PUT_METADATA_ACCOUNT,
+  RGW_OP_PUT_METADATA_BUCKET,
+  RGW_OP_PUT_METADATA_OBJECT,
+  RGW_OP_SET_TEMPURL,
+  RGW_OP_DELETE_OBJ,
+  RGW_OP_COPY_OBJ,
+  RGW_OP_GET_ACLS,
+  RGW_OP_PUT_ACLS,
+  RGW_OP_GET_CORS,
+  RGW_OP_PUT_CORS,
+  RGW_OP_DELETE_CORS,
+  RGW_OP_OPTIONS_CORS,
+  RGW_OP_INIT_MULTIPART,
+  RGW_OP_COMPLETE_MULTIPART,
+  RGW_OP_ABORT_MULTIPART,
+  RGW_OP_LIST_MULTIPART,
+  RGW_OP_LIST_BUCKET_MULTIPARTS,
+  RGW_OP_DELETE_MULTI_OBJ,
+};
+
 class RGWAccessControlPolicy;
 class JSONObj;
 
@@ -1089,6 +1123,7 @@ struct req_state {
    CephContext *cct;
    RGWClientIO *cio;
    http_op op;
+   RGWOpType op_type;
    bool content_started;
    int format;
    ceph::Formatter *formatter;
index 6666ef267a30a0f4c72c01ce80b6143e370d116d..f59a79b12255128bfe215cfb21d486c2b47a59ef 100644 (file)
@@ -583,6 +583,8 @@ static int process_request(RGWRados *store, RGWREST *rest, RGWRequest *req, RGWC
   req->op = op;
   dout(10) << "op=" << typeid(*op).name() << dendl;
 
+  s->op_type = op->get_type();
+
   req->log(s, "authorizing");
   ret = handler->authorize();
   if (ret < 0) {
index f1989e3f140c4b2c38066b9771c052d4a049c3a5..6b69c01ea39fd3289732ed7011da3fdf4c22a403 100644 (file)
@@ -31,45 +31,6 @@ using namespace std;
 struct req_state;
 class RGWHandler;
 
-enum RGWOpType {
-  RGW_OP_UNKNOWN = 0,
-  RGW_OP_GET_OBJ,
-  RGW_OP_LIST_BUCKETS,
-  RGW_OP_STAT_ACCOUNT,
-  RGW_OP_LIST_BUCKET,
-  RGW_OP_GET_BUCKET_LOGGING,
-  RGW_OP_GET_BUCKET_VERSIONING,
-  RGW_OP_SET_BUCKET_VERSIONING,
-  RGW_OP_GET_BUCKET_WEBSITE,
-  RGW_OP_SET_BUCKET_WEBSITE,
-  RGW_OP_STAT_BUCKET,
-  RGW_OP_CREATE_BUCKET,
-  RGW_OP_DELETE_BUCKET,
-  RGW_OP_PUT_OBJ,
-  RGW_OP_POST_OBJ,
-  RGW_OP_PUT_METADATA_ACCOUNT,
-  RGW_OP_PUT_METADATA_BUCKET,
-  RGW_OP_PUT_METADATA_OBJECT,
-  RGW_OP_SET_TEMPURL,
-  RGW_OP_DELETE_OBJ,
-  RGW_OP_COPY_OBJ,
-  RGW_OP_GET_ACLS,
-  RGW_OP_PUT_ACLS,
-  RGW_OP_GET_CORS,
-  RGW_OP_PUT_CORS,
-  RGW_OP_DELETE_CORS,
-  RGW_OP_OPTIONS_CORS,
-  RGW_OP_GET_REQUEST_PAYMENT,
-  RGW_OP_SET_REQUEST_PAYMENT,
-  RGW_OP_INIT_MULTIPART,
-  RGW_OP_COMPLETE_MULTIPART,
-  RGW_OP_ABORT_MULTIPART,
-  RGW_OP_LIST_MULTIPART,
-  RGW_OP_LIST_BUCKET_MULTIPARTS,
-  RGW_OP_DELETE_MULTI_OBJ,
-  RGW_OP_BULK_DELETE
-};
-
 /**
  * Provide the base class for all ops.
  */
index ab9f14a5f67c0f20047b8c89931a49dfa56579cb..079a6493f1b4be3aef7b45570de0c25d6f73ac13 100644 (file)
@@ -3117,10 +3117,25 @@ int RGW_Auth_S3::authorize_v4(RGWRados *store, struct req_state *s)
 
     /* aws4 auth not completed... delay aws4 auth */
 
-    s->aws4_auth_needs_complete = true;
-
     dout(10) << "body content detected... delaying v4 auth" << dendl;
 
+    switch (s->op_type)
+    {
+      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:
+        break;
+      default:
+        dout(10) << "ERROR: AWS4 completion for this operation NOT IMPLEMENTED" << dendl;
+        return -ERR_NOT_IMPLEMENTED;
+    }
+
+    s->aws4_auth_needs_complete = true;
+
   }
 
   map<string, RGWAccessKey>::iterator iter = s->user.access_keys.find(s->aws4_auth->access_key_id);