Fixes: https://tracker.ceph.com/issues/51206
Signed-off-by: caolei <halei15848934852@163.com>
if (op_ret < 0) {
return;
}
+ std::string user_tenant = s->user->get_tenant();
std::unique_ptr<rgw::sal::RGWRole> role = store->get_role(role_name,
- s->user->get_tenant(),
+ user_tenant,
role_path,
trust_policy,
max_session_duration);
+ if (!user_tenant.empty() && role->get_tenant() != user_tenant) {
+ ldpp_dout(this, 20) << "ERROR: the tenant provided in the role name does not match with the tenant of the user creating the role"
+ << dendl;
+ op_ret = -EINVAL;
+ return;
+ }
op_ret = role->create(s, true, y);
if (op_ret == -EEXIST) {