Skip to content

Commit 5378cfe

Browse files
committed
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 <[email protected]>
1 parent e6ceec4 commit 5378cfe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/rgw/driver/rados/rgw_user.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,11 @@ int RGWUser::execute_add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_
17551755
user_info.display_name = display_name;
17561756
user_info.type = TYPE_RGW;
17571757

1758-
// tenant must not look like a valid account id
1758+
// user/tenant must not look like a valid account id
1759+
if (rgw::account::validate_id(uid.id)) {
1760+
set_err_msg(err_msg, "uid must not be formatted as an account id");
1761+
return -EINVAL;
1762+
}
17591763
if (rgw::account::validate_id(uid.tenant)) {
17601764
set_err_msg(err_msg, "tenant must not be formatted as an account id");
17611765
return -EINVAL;

0 commit comments

Comments
 (0)