kernel/team: Remove team_get_team_struct, add team_geteuid.
Thanks to Axel for the review.
This commit is contained in:
@@ -2859,13 +2859,8 @@ _user_install_default_debugger(port_id debuggerPort)
|
|||||||
port_id
|
port_id
|
||||||
_user_install_team_debugger(team_id teamID, port_id debuggerPort)
|
_user_install_team_debugger(team_id teamID, port_id debuggerPort)
|
||||||
{
|
{
|
||||||
if (geteuid() != 0) {
|
if (geteuid() != 0 && team_geteuid(teamID) != geteuid())
|
||||||
Team* team = team_get_team_struct(teamID);
|
return B_PERMISSION_DENIED;
|
||||||
if (team == NULL)
|
|
||||||
return B_BAD_VALUE;
|
|
||||||
if (team->effective_uid != geteuid())
|
|
||||||
return B_PERMISSION_DENIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return install_team_debugger(teamID, debuggerPort, -1, false, false);
|
return install_team_debugger(teamID, debuggerPort, -1, false, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2918,15 +2918,8 @@ team_is_valid(team_id id)
|
|||||||
if (id <= 0)
|
if (id <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return team_get_team_struct(id) != NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Team*
|
|
||||||
team_get_team_struct(team_id id)
|
|
||||||
{
|
|
||||||
InterruptsReadSpinLocker teamsLocker(sTeamHashLock);
|
InterruptsReadSpinLocker teamsLocker(sTeamHashLock);
|
||||||
return team_get_team_struct_locked(id);
|
return team_get_team_struct_locked(id) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3021,6 +3014,17 @@ team_set_foreground_process_group(int32 ttyIndex, pid_t processGroupID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uid_t
|
||||||
|
team_geteuid(team_id id)
|
||||||
|
{
|
||||||
|
InterruptsReadSpinLocker teamsLocker(sTeamHashLock);
|
||||||
|
Team* team = team_get_team_struct_locked(id);
|
||||||
|
if (team == NULL)
|
||||||
|
return (uid_t)-1;
|
||||||
|
return team->effective_uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Removes the specified team from the global team hash, from its process
|
/*! Removes the specified team from the global team hash, from its process
|
||||||
group, and from its parent.
|
group, and from its parent.
|
||||||
It also moves all of its children to the kernel team.
|
It also moves all of its children to the kernel team.
|
||||||
|
|||||||
Reference in New Issue
Block a user