summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2008-10-09 06:34:11 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2008-10-09 06:34:11 +0000
commit69929ed1dc876facf609e9e5c1d1b1d07c5b8d27 (patch)
treea5f59df4cd36a00babf78ad473b16a57f28c7b2c
parent7dc51960a8c8e29c12cecef0e6bdb4d3930c0f4f (diff)
Use the reference count in struct process to update the proc count
for users by the correct amount when changing real UID on (r)threaded processes. ok art@ tedu@
-rw-r--r--sys/kern/kern_prot.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 1b4c8aac09a..08cbc54dcaa 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_prot.c,v 1.31 2008/05/22 21:27:40 thib Exp $ */
+/* $OpenBSD: kern_prot.c,v 1.32 2008/10/09 06:34:10 guenther Exp $ */
/* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */
/*
@@ -377,8 +377,8 @@ sys_setresuid(struct proc *p, void *v, register_t *retval)
/*
* Transfer proc count to new user.
*/
- (void)chgproccnt(pc->p_ruid, -1);
- (void)chgproccnt(ruid, 1);
+ (void)chgproccnt(pc->p_ruid, -p->p_p->ps_refcnt);
+ (void)chgproccnt(ruid, p->p_p->ps_refcnt);
pc->p_ruid = ruid;
}
if (euid != (uid_t)-1 && euid != pc->pc_ucred->cr_uid) {
@@ -582,8 +582,8 @@ sys_setuid(struct proc *p, void *v, register_t *retval)
* Transfer proc count to new user.
*/
if (uid != pc->p_ruid) {
- (void)chgproccnt(pc->p_ruid, -1);
- (void)chgproccnt(uid, 1);
+ (void)chgproccnt(pc->p_ruid, -p->p_p->ps_refcnt);
+ (void)chgproccnt(uid, p->p_p->ps_refcnt);
}
pc->p_ruid = uid;
pc->p_svuid = uid;