Update osf1_setuid() and osf1_setgid() to use the new change_euid() and
change_ruid() in kern_prot.c. This fixes an incorrect use of chgproccnt(). Update both osf1_setuid() and osf1_setgid() to use setsugid() instead of just frobbing the flag. (mostly) submitted by: truckman
This commit is contained in:
parent
810bfc8ea1
commit
af06b8d8a5
@ -1070,15 +1070,20 @@ osf1_setuid(p, uap)
|
||||
uid != pc->p_ruid && uid != pc->p_svuid)
|
||||
return (error);
|
||||
|
||||
pc->pc_ucred = crcopy(pc->pc_ucred);
|
||||
pc->pc_ucred->cr_uid = uid;
|
||||
if (error == 0) {
|
||||
(void)chgproccnt(pc->p_ruid, -1, 0);
|
||||
(void)chgproccnt(uid, 1, 0);
|
||||
pc->p_ruid = uid;
|
||||
pc->p_svuid = uid;
|
||||
if (uid != pc->p_ruid) {
|
||||
change_ruid(p, uid);
|
||||
setsugid(p);
|
||||
}
|
||||
if (pc->p_svuid != uid) {
|
||||
pc->p_svuid = uid;
|
||||
setsugid(p);
|
||||
}
|
||||
}
|
||||
if (pc->pc_ucred->cr_uid != uid) {
|
||||
change_euid(p, uid);
|
||||
setsugid(p);
|
||||
}
|
||||
p->p_flag |= P_SUGID;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1112,7 +1117,7 @@ osf1_setgid(p, uap)
|
||||
pc->p_rgid = gid;
|
||||
pc->p_svgid = gid;
|
||||
}
|
||||
p->p_flag |= P_SUGID;
|
||||
setsugid(p);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user