mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Back out over-aggressive locking of p->p_cred.
Requested by: alfred
This commit is contained in:
parent
1718c8b735
commit
7b1bec368f
1 changed files with 3 additions and 16 deletions
|
|
@ -1066,35 +1066,26 @@ osf1_setuid(p, uap)
|
|||
register struct pcred *pc;
|
||||
|
||||
uid = SCARG(uap, uid);
|
||||
PROC_LOCK(p);
|
||||
pc = p->p_cred;
|
||||
|
||||
if ((error = suser(p)) != 0 &&
|
||||
uid != pc->p_ruid && uid != pc->p_svuid) {
|
||||
PROC_UNLOCK(p);
|
||||
uid != pc->p_ruid && uid != pc->p_svuid)
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (error == 0) {
|
||||
if (uid != pc->p_ruid) {
|
||||
PROC_UNLOCK(p);
|
||||
change_ruid(p, uid);
|
||||
setsugid(p);
|
||||
PROC_LOCK(p);
|
||||
}
|
||||
if (pc->p_svuid != uid) {
|
||||
PROC_UNLOCK(p);
|
||||
pc->p_svuid = uid;
|
||||
setsugid(p);
|
||||
PROC_LOCK(p);
|
||||
}
|
||||
}
|
||||
if (pc->pc_ucred->cr_uid != uid) {
|
||||
PROC_UNLOCK(p);
|
||||
change_euid(p, uid);
|
||||
setsugid(p);
|
||||
} else
|
||||
PROC_UNLOCK(p);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -1116,14 +1107,11 @@ osf1_setgid(p, uap)
|
|||
register struct pcred *pc;
|
||||
|
||||
gid = SCARG(uap, gid);
|
||||
PROC_LOCK(p);
|
||||
pc = p->p_cred;
|
||||
|
||||
if (((error = suser(p)) != 0 ) &&
|
||||
gid != pc->p_rgid && gid != pc->p_svgid) {
|
||||
PROC_UNLOCK(p);
|
||||
gid != pc->p_rgid && gid != pc->p_svgid)
|
||||
return (error);
|
||||
}
|
||||
|
||||
pc->pc_ucred = crcopy(pc->pc_ucred);
|
||||
pc->pc_ucred->cr_gid = gid;
|
||||
|
|
@ -1131,7 +1119,6 @@ osf1_setgid(p, uap)
|
|||
pc->p_rgid = gid;
|
||||
pc->p_svgid = gid;
|
||||
}
|
||||
PROC_UNLOCK(p);
|
||||
setsugid(p);
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue