]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix bug encoding percentage char in X-Amz-Credential
authorJavier M. Mellid <jmunhoz@igalia.com>
Sat, 23 Jan 2016 19:23:17 +0000 (20:23 +0100)
committerJavier M. Mellid <jmunhoz@igalia.com>
Sat, 13 Feb 2016 12:53:05 +0000 (12:53 +0000)
The X-Amz-Credential value in the URL shows the "/" character only for
readability. In practice, it should be encoded as %2F

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
src/rgw/rgw_rest_s3.cc

index 75c543c4832a94dd1b4e2707b1b388997e65fe0e..2ff9f4bb29aff0efd72db893c87b2599508373cd 100644 (file)
@@ -3126,11 +3126,14 @@ int RGW_Auth_S3::authorize_v4(RGWRados *store, struct req_state *s)
       if (!using_qs || key != "X-Amz-Signature") {
         string encoded_key;
         string encoded_val;
-
-        aws4_uri_encode(key, encoded_key);
-        aws4_uri_encode(val, encoded_val);
-
-       canonical_qs_map[encoded_key] = encoded_val;
+        if (key != "X-Amz-Credential") {
+          aws4_uri_encode(key, encoded_key);
+          aws4_uri_encode(val, encoded_val);
+        } else {
+          encoded_key = key;
+          encoded_val = val;
+        }
+        canonical_qs_map[encoded_key] = encoded_val;
       }
     }