From: Pritha Srivastava Date: Mon, 29 Aug 2016 09:02:42 +0000 (+0530) Subject: rgw: Replacing '+' with "%20" in canonical uri for s3 v4 auth. X-Git-Tag: v11.1.0~582^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=20e5ff023ebad89c386a520d07613547d4836399;p=ceph.git rgw: Replacing '+' with "%20" in canonical uri for s3 v4 auth. s3cmd encodes space as "%20" while signature computation and encodes space as '+' while sending the canonical uri. This results in a SignatureMismatch Error in rgw, since rgw computes the signature based on the request received from the client (s3cmd in this case). Fixes http://tracker.ceph.com/issues/17076. Signed-off-by: Pritha Srivastava --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index e464ddb002d..2a5b5291d64 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -11,6 +11,7 @@ #include "common/ceph_json.h" #include "common/safe_io.h" #include +#include #include "rgw_rest.h" #include "rgw_rest_s3.h" @@ -3595,6 +3596,8 @@ int RGW_Auth_S3::authorize_v4(RGWRados *store, struct req_state *s) if (s->aws4_auth->canonical_uri.empty()) { s->aws4_auth->canonical_uri = "/"; + } else { + boost::replace_all(s->aws4_auth->canonical_uri, "+", "%20"); } /* craft canonical query string */