]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw:When KMS encryption is used and the key does not exist, we should not throw ERR_... 37184/head
authorwangyingbin <wangyingbin@inspur.com>
Wed, 16 Sep 2020 07:15:45 +0000 (15:15 +0800)
committerwangyingbin <wangyingbin@inspur.com>
Wed, 16 Sep 2020 07:15:45 +0000 (15:15 +0800)
When kms encryption is used, the key_id is null or the actual_key size is wrong, we should not throw "ERR_INVALID_ACCESS_KEY " error code, instead of "EINVAL"error code, is used to indicate parameter error.

Signed-off-by: wangyingbin <wangyingbin@inspur.com>
src/rgw/rgw_crypt.cc

index 176a830430e0909219e91c32f54d8147bbd7c755..3a040da942cca7aa05d6cf58c466c8d6cd619e90 100644 (file)
@@ -782,7 +782,7 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
          ldout(s->cct, 5) << "ERROR: not provide a valid key id" << dendl;
          s->err.message = "Server Side Encryption with KMS managed key requires "
            "HTTP header x-amz-server-side-encryption-aws-kms-key-id";
-         return -ERR_INVALID_ACCESS_KEY;
+         return -EINVAL;
        }
        /* try to retrieve actual key */
        std::string key_selector = create_random_key_selector(s->cct);
@@ -797,7 +797,7 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
          ldout(s->cct, 5) << "ERROR: key obtained from key_id:" <<
             key_id << " is not 256 bit size" << dendl;
          s->err.message = "KMS provided an invalid key for the given kms-keyid.";
-         return -ERR_INVALID_ACCESS_KEY;
+         return -EINVAL;
        }
        set_attr(attrs, RGW_ATTR_CRYPT_MODE, "SSE-KMS");
        set_attr(attrs, RGW_ATTR_CRYPT_KEYID, key_id);