]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: radosgw-admin abort early for user stats for empty uids 20846/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Mon, 12 Mar 2018 13:14:22 +0000 (14:14 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Mon, 12 Mar 2018 13:14:22 +0000 (14:14 +0100)
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 <abhishek@suse.com>
src/rgw/rgw_admin.cc

index e8573ae7932772bea9d52ed9b8cc8697f8b9be50..3aa585dac9caae8f9f5c49fb37de78ea7d7d96e6 100644 (file)
@@ -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);