From: Abhishek Lekshmanan Date: Mon, 12 Mar 2018 13:14:22 +0000 (+0100) Subject: rgw: radosgw-admin abort early for user stats for empty uids X-Git-Tag: wip-pdonnell-testing-20180329.205607~70^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aa3a408d4a66296cbf273551920f8ac9b381b2dd;p=ceph-ci.git rgw: radosgw-admin abort early for user stats for empty uids Otherwise we'll call sync stats with an empty argument which results in creation of an empty ".buckets" object Fixes: http://tracker.ceph.com/issues/23322 Signed-off-by: Abhishek Lekshmanan --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index e8573ae7932..3aa585dac9c 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -6140,6 +6140,11 @@ next: } if (opt_cmd == OPT_USER_STATS) { + if (user_id.empty()) { + cerr << "ERROR: uid not specified" << std::endl; + return EINVAL; + } + if (sync_stats) { if (!bucket_name.empty()) { int ret = rgw_bucket_sync_user_stats(store, tenant, bucket_name); @@ -6156,10 +6161,6 @@ next: } } - if (user_id.empty()) { - cerr << "ERROR: uid not specified" << std::endl; - return EINVAL; - } cls_user_header header; string user_str = user_id.to_str(); int ret = store->cls_user_get_header(user_str, &header);