From 5378cfe3c5bf5953b53beee42975d045759238b1 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 25 Nov 2024 13:07:46 -0500 Subject: [PATCH] radosgw-admin: 'user create' rejects uids matching the account id format `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 --- src/rgw/driver/rados/rgw_user.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rgw/driver/rados/rgw_user.cc b/src/rgw/driver/rados/rgw_user.cc index 94a18ffcbab7..894d8e409509 100644 --- a/src/rgw/driver/rados/rgw_user.cc +++ b/src/rgw/driver/rados/rgw_user.cc @@ -1755,7 +1755,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; -- 2.47.3