]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: url decode PutUserPolicy params 29970/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Fri, 9 Aug 2019 14:53:51 +0000 (16:53 +0200)
committerNathan Cutler <ncutler@suse.com>
Wed, 28 Aug 2019 15:40:42 +0000 (17:40 +0200)
Since these are sent as a part of a POST request which is usually urlencoded,
the json parser would later return invalid json for jsons containing whitespace

Fixes: https://tracker.ceph.com/issues/41189
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit fac4ab71fbee7f187db57e268c2e750eaf2802bc)

src/rgw/rgw_rest_user_policy.cc

index 31323f34038b338a553f7dfa813bd42c398ee1c0..c4720749a75c684798bf2bdb70a70f9d0e8a6b1f 100644 (file)
@@ -90,9 +90,9 @@ uint64_t RGWPutUserPolicy::get_op()
 
 int RGWPutUserPolicy::get_params()
 {
-  policy_name = s->info.args.get("PolicyName");
-  user_name = s->info.args.get("UserName");
-  policy = s->info.args.get("PolicyDocument");
+  policy_name = url_decode(s->info.args.get("PolicyName"), true);
+  user_name = url_decode(s->info.args.get("UserName"), true);
+  policy = url_decode(s->info.args.get("PolicyDocument"), true);
 
   if (policy_name.empty() || user_name.empty() || policy.empty()) {
     ldout(s->cct, 20) << "ERROR: one of policy name, user name or policy document is empty"