diff options
| author | christos <christos@NetBSD.org> | 2005-12-11 12:16:03 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2005-12-11 12:16:03 +0000 |
| commit | 95e1ffb15694e54f29f8baaa4232152b703c2a5a (patch) | |
| tree | d6510e195bc06092a8057e34c6442eba4e77d09a /sys/kern/exec_script.c | |
| parent | 4f17ba81bcaf3f5086d88a346cbfd12506a5e3e6 (diff) | |
merge ktrace-lwp.
Diffstat (limited to 'sys/kern/exec_script.c')
| -rw-r--r-- | sys/kern/exec_script.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c index e3ae521f991..3a7ceaa9d88 100644 --- a/sys/kern/exec_script.c +++ b/sys/kern/exec_script.c @@ -1,4 +1,4 @@ -/* $NetBSD: exec_script.c,v 1.44 2005/07/29 14:49:00 elad Exp $ */ +/* $NetBSD: exec_script.c,v 1.45 2005/12/11 12:24:29 christos Exp $ */ /* * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.44 2005/07/29 14:49:00 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.45 2005/12/11 12:24:29 christos Exp $"); #if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS) #define FDSCRIPTS /* Need this for safe set-id scripts. */ @@ -77,13 +77,14 @@ __KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.44 2005/07/29 14:49:00 elad Exp $" * into the exec package. */ int -exec_script_makecmds(struct proc *p, struct exec_package *epp) +exec_script_makecmds(struct lwp *l, struct exec_package *epp) { int error, hdrlinelen, shellnamelen, shellarglen; char *hdrstr = epp->ep_hdr; char *cp, *shellname, *shellarg, *oldpnbuf; char **shellargp, **tmpsap; struct vnode *scriptvp; + struct proc *p = l->l_proc; #ifdef SETUIDSCRIPTS /* Gcc needs those initialized for spurious uninitialized warning */ uid_t script_uid = (uid_t) -1; @@ -183,7 +184,7 @@ check_shell: * method of implementing "safe" set-id and x-only scripts. */ vn_lock(epp->ep_vp, LK_EXCLUSIVE | LK_RETRY); - error = VOP_ACCESS(epp->ep_vp, VREAD, p->p_ucred, p); + error = VOP_ACCESS(epp->ep_vp, VREAD, l->l_proc->p_ucred, l); VOP_UNLOCK(epp->ep_vp, 0); if (error == EACCES #ifdef SETUIDSCRIPTS @@ -210,7 +211,7 @@ check_shell: fp->f_data = (caddr_t) epp->ep_vp; fp->f_flag = FREAD; FILE_SET_MATURE(fp); - FILE_UNUSE(fp, p); + FILE_UNUSE(fp, l); } #endif @@ -277,9 +278,9 @@ check_shell: oldpnbuf = epp->ep_ndp->ni_cnd.cn_pnbuf; #ifdef VERIFIED_EXEC - if ((error = check_exec(p, epp, VERIEXEC_INDIRECT)) == 0) { + if ((error = check_exec(l, epp, VERIEXEC_INDIRECT)) == 0) { #else - if ((error = check_exec(p, epp, 0)) == 0) { + if ((error = check_exec(l, epp, 0)) == 0) { #endif /* note that we've clobbered the header */ epp->ep_flags |= EXEC_DESTR|EXEC_HASES; @@ -292,7 +293,7 @@ check_shell: */ if ((epp->ep_flags & EXEC_HASFD) == 0) { vn_lock(scriptvp, LK_EXCLUSIVE | LK_RETRY); - VOP_CLOSE(scriptvp, FREAD, p->p_ucred, p); + VOP_CLOSE(scriptvp, FREAD, p->p_ucred, l); vput(scriptvp); } @@ -328,10 +329,10 @@ fail: /* kill the opened file descriptor, else close the file */ if (epp->ep_flags & EXEC_HASFD) { epp->ep_flags &= ~EXEC_HASFD; - (void) fdrelease(p, epp->ep_fd); + (void) fdrelease(l, epp->ep_fd); } else if (scriptvp) { vn_lock(scriptvp, LK_EXCLUSIVE | LK_RETRY); - VOP_CLOSE(scriptvp, FREAD, p->p_ucred, p); + VOP_CLOSE(scriptvp, FREAD, p->p_ucred, l); vput(scriptvp); } |
