]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add a new error code for invalid secret key
authorDunrong Huang <riegamaths@gmail.com>
Wed, 23 Dec 2015 14:05:49 +0000 (22:05 +0800)
committerDunrong Huang <riegamaths@gmail.com>
Wed, 23 Dec 2015 14:30:58 +0000 (22:30 +0800)
From http://docs.ceph.com/docs/master/radosgw/adminops/ when invalid secret
key specified, rgw should return 400 with InvalidSecretKey

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
src/rgw/rgw_common.h
src/rgw/rgw_http_errors.h
src/rgw/rgw_user.cc

index 9565f98e84b2c864c9af7039d95d457557878eab..505098a81d0d7ce60c4b065bcc565da3c757b88d 100644 (file)
@@ -158,6 +158,7 @@ using ceph::crypto::MD5;
 #define ERR_NOT_SLO_MANIFEST     2031
 #define ERR_EMAIL_EXIST          2032
 #define ERR_KEY_EXIST            2033
+#define ERR_INVALID_SECRET_KEY   2034
 #define ERR_USER_SUSPENDED       2100
 #define ERR_INTERNAL_ERROR       2200
 #define ERR_NOT_IMPLEMENTED      2201
index 0bb69fa737787230f0684ecbc4291a5c312d575c..9d2ab3c718663b95401f64e73bea1433c880eb9b 100644 (file)
@@ -53,6 +53,7 @@ const static struct rgw_http_errors RGW_HTTP_ERRORS[] = {
     { ERR_USER_EXIST, 409, "UserAlreadyExists" },
     { ERR_EMAIL_EXIST, 409, "EmailExists" },
     { ERR_KEY_EXIST, 409, "KeyExists"},
+    { ERR_INVALID_SECRET_KEY, 400, "InvalidSecretKey"},
     { ENOTEMPTY, 409, "BucketNotEmpty" },
     { ERR_PRECONDITION_FAILED, 412, "PreconditionFailed" },
     { ERANGE, 416, "InvalidRange" },
index fb46e4e8acf5a221eb76314b51c567bc966b720a..14b1f14c313998a5aadafa63705790d53cd4eff5 100644 (file)
@@ -917,7 +917,7 @@ int RGWAccessKeyPool::generate_key(RGWUserAdminOpState& op_state, std::string *e
   if (!gen_secret) {
     if (op_state.get_secret_key().empty()) {
       set_err_msg(err_msg, "empty secret key");
-      return -EINVAL; 
+      return -ERR_INVALID_SECRET_KEY;
     }
   
     key = op_state.get_secret_key();
@@ -1049,7 +1049,7 @@ int RGWAccessKeyPool::modify_key(RGWUserAdminOpState& op_state, std::string *err
 
   if (key.empty()) {
       set_err_msg(err_msg, "empty secret key");
-      return  -EINVAL;
+      return -ERR_INVALID_SECRET_KEY;
   }
 
   // update the access key with the new secret key