- Don't cast kauth_cred_t to (struct ucred *), just set pc_ucred = NULL.
- Fill ucred::cr_ref.
This commit is contained in:
parent
55a5faa1ef
commit
2af3d29e01
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init_sysctl.c,v 1.76 2006/07/16 20:21:42 elad Exp $ */
|
||||
/* $NetBSD: init_sysctl.c,v 1.77 2006/07/17 14:47:02 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.76 2006/07/16 20:21:42 elad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.77 2006/07/17 14:47:02 ad Exp $");
|
||||
|
||||
#include "opt_sysv.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
@ -3074,15 +3074,11 @@ fill_eproc(struct proc *p, struct eproc *ep)
|
||||
{
|
||||
struct tty *tp;
|
||||
struct lwp *l;
|
||||
struct pcred pc;
|
||||
struct ucred uc;
|
||||
|
||||
ep->e_paddr = p;
|
||||
ep->e_sess = p->p_session;
|
||||
kauth_cred_topcred(p->p_cred, &pc);
|
||||
kauth_cred_toucred(p->p_cred, &uc);
|
||||
ep->e_pcred = pc;
|
||||
ep->e_ucred = uc;
|
||||
kauth_cred_topcred(p->p_cred, &ep->e_pcred);
|
||||
kauth_cred_toucred(p->p_cred, &ep->e_ucred);
|
||||
if (p->p_stat == SIDL || P_ZOMBIE(p)) {
|
||||
ep->e_vm.vm_rssize = 0;
|
||||
ep->e_vm.vm_tsize = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_auth.c,v 1.11 2006/07/17 14:37:20 ad Exp $ */
|
||||
/* $NetBSD: kern_auth.c,v 1.12 2006/07/17 14:47:02 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
|
||||
@ -459,8 +459,7 @@ kauth_cred_uucmp(kauth_cred_t cred, const struct uucred *uuc)
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a struct ucred out of a kauth_cred_t.
|
||||
* XXX: For sysctl.
|
||||
* Make a struct ucred out of a kauth_cred_t. For compatibility.
|
||||
*/
|
||||
void
|
||||
kauth_cred_toucred(kauth_cred_t cred, struct ucred *uc)
|
||||
@ -468,6 +467,7 @@ kauth_cred_toucred(kauth_cred_t cred, struct ucred *uc)
|
||||
KASSERT(cred != NULL);
|
||||
KASSERT(uc != NULL);
|
||||
|
||||
uc->cr_ref = cred->cr_refcnt;
|
||||
uc->cr_uid = cred->cr_euid;
|
||||
uc->cr_gid = cred->cr_egid;
|
||||
uc->cr_ngroups = min(cred->cr_ngroups,
|
||||
@ -477,8 +477,7 @@ kauth_cred_toucred(kauth_cred_t cred, struct ucred *uc)
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a struct pcred out of a kauth_cred_t.
|
||||
* XXX: For sysctl.
|
||||
* Make a struct pcred out of a kauth_cred_t. For compatibility.
|
||||
*/
|
||||
void
|
||||
kauth_cred_topcred(kauth_cred_t cred, struct pcred *pc)
|
||||
@ -486,7 +485,7 @@ kauth_cred_topcred(kauth_cred_t cred, struct pcred *pc)
|
||||
KASSERT(cred != NULL);
|
||||
KASSERT(pc != NULL);
|
||||
|
||||
pc->pc_ucred = (struct ucred *)cred; /* XXX this is just wrong */
|
||||
pc->pc_ucred = NULL;
|
||||
pc->p_ruid = cred->cr_uid;
|
||||
pc->p_svuid = cred->cr_svuid;
|
||||
pc->p_rgid = cred->cr_gid;
|
||||
|
Loading…
Reference in New Issue
Block a user