]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
On new uid check, return EEXIST.
authorShilpa Jagannath <smanjara@redhat.com>
Tue, 30 Jul 2019 08:14:26 +0000 (13:44 +0530)
committerShilpa Jagannath <smanjara@redhat.com>
Tue, 30 Jul 2019 08:30:46 +0000 (14:00 +0530)
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
src/rgw/rgw_user.cc

index 960246ab096b7774914d0d0bd2d08c22a4235e23..59664fb80611652b5c3444a031857acc65177f6f 100644 (file)
@@ -1962,8 +1962,17 @@ int RGWUser::execute_user_rename(RGWUserAdminOpState& op_state, std::string *err
 
   rgw_user& uid = op_state.get_new_uid();
 
+  RGWUserInfo existing_uinfo;
+  if (!uid.empty()) {
+    ret = rgw_get_user_info_by_uid(store, uid, existing_uinfo);
+    if (ret >= 0) {
+      set_err_msg(err_msg, "user name given by --new-uid already exists");
+      return -EEXIST;
+    }
+  }
+
   if (old_uid.tenant != uid.tenant) {
-    set_err_msg(err_msg, "Users have to be under the same tenant namespace " 
+    set_err_msg(err_msg, "users have to be under the same tenant namespace"
                 + old_uid.tenant + "!=" + uid.tenant);
     return -EINVAL;
   }