]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Replacing '+' with "%20" in canonical uri for s3 v4 auth. 10919/head
authorPritha Srivastava <prsrivas@redhat.com>
Mon, 29 Aug 2016 09:02:42 +0000 (14:32 +0530)
committerPritha Srivastava <prsrivas@redhat.com>
Thu, 1 Sep 2016 04:52:46 +0000 (10:22 +0530)
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 <prsrivas@redhat.com>
src/rgw/rgw_rest_s3.cc

index e464ddb002d3b1e73ae304d15dea461ef1ae157c..2a5b5291d64cb94cc3e5ddc4a00bbde14b78324b 100644 (file)
@@ -11,6 +11,7 @@
 #include "common/ceph_json.h"
 #include "common/safe_io.h"
 #include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/replace.hpp>
 
 #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 */