]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rgw_admin checks that it hasn't regenerated user ids
authorGreg Farnum <gregf@hq.newdream.net>
Mon, 5 Apr 2010 20:59:52 +0000 (13:59 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Mon, 5 Apr 2010 20:59:52 +0000 (13:59 -0700)
src/rgw/rgw_admin.cc

index fc092563e14e5e4b6a30d23b5228606c8bf0811e..b11c16c432f9e1fe8f767284633378063a2826a7 100644 (file)
@@ -178,12 +178,17 @@ int main(int argc, char **argv)
       secret_key = secret_key_buf;
     }
     if (!user_id) {
-      ret = gen_rand_alphanumeric(public_id_buf, sizeof(public_id_buf));
-      if (ret < 0) {
-        cerr << "aborting" << std::endl;
-        exit(1);
-      }
-      user_id = public_id_buf;
+      RGWUserInfo duplicate_check;
+      string duplicate_check_id;
+      do {
+       ret = gen_rand_alphanumeric(public_id_buf, sizeof(public_id_buf));
+       if (ret < 0) {
+         cerr << "aborting" << std::endl;
+         exit(1);
+       }
+       user_id = public_id_buf;
+       duplicate_check_id = user_id;
+      } while (!rgw_get_user_info(duplicate_check_id, duplicate_check));
     }
   }