]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw-admin: 'user create' rejects uids matching the account id format 60980/head
authorCasey Bodley <cbodley@redhat.com>
Mon, 25 Nov 2024 18:07:46 +0000 (13:07 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 6 Dec 2024 14:51:37 +0000 (09:51 -0500)
`parse_owner()` relies on `rgw::account::validate_id()` to disambiguate
between user ids and account ids. reject attempts to create a user with
an ambiguous user id

Fixes: https://tracker.ceph.com/issues/69043
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 5378cfe3c5bf5953b53beee42975d045759238b1)

src/rgw/driver/rados/rgw_user.cc

index 5fe57c6514721972a6321131193587e5ef8b1d8c..d37990dc5f34cfa8943ed294e080b10643ed134c 100644 (file)
@@ -1749,7 +1749,11 @@ int RGWUser::execute_add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_
   user_info.display_name = display_name;
   user_info.type = TYPE_RGW;
 
-  // tenant must not look like a valid account id
+  // user/tenant must not look like a valid account id
+  if (rgw::account::validate_id(uid.id)) {
+    set_err_msg(err_msg, "uid must not be formatted as an account id");
+    return -EINVAL;
+  }
   if (rgw::account::validate_id(uid.tenant)) {
     set_err_msg(err_msg, "tenant must not be formatted as an account id");
     return -EINVAL;