Skip to content

Commit

Permalink
rgw: Replacing '+' with "%20" in canonical uri for s3 v4 auth.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
pritha-srivastava committed Sep 1, 2016
1 parent 0c9ada8 commit 20e5ff0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rgw/rgw_rest_s3.cc
Expand Up @@ -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"
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 20e5ff0

Please sign in to comment.