]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: url decode PutUserPolicy params 29578/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Fri, 9 Aug 2019 14:53:51 +0000 (16:53 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Fri, 9 Aug 2019 14:57:25 +0000 (16:57 +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>
src/rgw/rgw_rest_user_policy.cc

index 7afd11775b78364760392d7a7b317ae811822d6e..d93f69aee2ea9f8fbab15e36194164be2c814cab 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"