for /admin/user GET requests, if a uid is not given, we ultimately
return an AccessDenied error, as we initialize an anon user by default
where operations like key initialization will throw an -EACCESS. Since
the actual failure here is that uid was not specified, return an
-EINVAL, HTTP 400 error instead which is more clearer.
Fixes: http://tracker.ceph.com/issues/15455
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
bool fetch_stats;
RESTArgs::get_string(s, "uid", uid_str, &uid_str);
+
+ // if uid was not supplied in rest argument, error out now, otherwise we'll
+ // end up initializing anonymous user, for which keys.init will eventually
+ // return -EACESS
+ if (uid_str.empty()){
+ http_ret=-EINVAL;
+ return;
+ }
+
rgw_user uid(uid_str);
RESTArgs::get_bool(s, "stats", false, &fetch_stats);