From 69929ed1dc876facf609e9e5c1d1b1d07c5b8d27 Mon Sep 17 00:00:00 2001 From: Philip Guenthe Date: Thu, 9 Oct 2008 06:34:11 +0000 Subject: 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@ --- sys/kern/kern_prot.c | 10 +++++----- 1 file 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; -- cgit v1.2.3