summaryrefslogtreecommitdiff
path: root/sys/kern/exec_script.c
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2006-07-23 22:06:03 +0000
committerad <ad@NetBSD.org>2006-07-23 22:06:03 +0000
commitf474dceb13c3c678cc12a81cf14f7448a5e6bca7 (patch)
tree2e9a4ca54c22bfea932b7fddcd5135f8d639a6e8 /sys/kern/exec_script.c
parent8a487b533dd09b33d58273719df7c9abf8a9042b (diff)
Use the LWP cached credentials where sane.
Diffstat (limited to 'sys/kern/exec_script.c')
-rw-r--r--sys/kern/exec_script.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c
index b680095a9ab..fa159b0c36b 100644
--- a/sys/kern/exec_script.c
+++ b/sys/kern/exec_script.c
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_script.c,v 1.48 2006/07/22 10:34:26 elad Exp $ */
+/* $NetBSD: exec_script.c,v 1.49 2006/07/23 22:06:10 ad 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.48 2006/07/22 10:34:26 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.49 2006/07/23 22:06:10 ad Exp $");
#if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
#define FDSCRIPTS /* Need this for safe set-id scripts. */
@@ -84,7 +84,6 @@ exec_script_makecmds(struct lwp *l, struct exec_package *epp)
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;
@@ -184,7 +183,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, l->l_proc->p_cred, l);
+ error = VOP_ACCESS(epp->ep_vp, VREAD, l->l_cred, l);
VOP_UNLOCK(epp->ep_vp, 0);
if (error == EACCES
#ifdef SETUIDSCRIPTS
@@ -199,7 +198,7 @@ check_shell:
#endif
/* falloc() will use the descriptor for us */
- if ((error = falloc(p, &fp, &epp->ep_fd)) != 0) {
+ if ((error = falloc(l, &fp, &epp->ep_fd)) != 0) {
scriptvp = NULL;
shellargp = NULL;
goto fail;
@@ -236,7 +235,7 @@ check_shell:
/* normally can't fail, but check for it if diagnostic */
#ifdef SYSTRACE
error = 1;
- if (ISSET(p->p_flag, P_SYSTRACE)) {
+ if (ISSET(l->l_proc->p_flag, P_SYSTRACE)) {
error = systrace_scriptname(p, *tmpsap);
if (error == 0)
tmpsap++;
@@ -293,7 +292,7 @@ check_shell:
*/
if ((epp->ep_flags & EXEC_HASFD) == 0) {
vn_lock(scriptvp, LK_EXCLUSIVE | LK_RETRY);
- VOP_CLOSE(scriptvp, FREAD, p->p_cred, l);
+ VOP_CLOSE(scriptvp, FREAD, l->l_cred, l);
vput(scriptvp);
}
@@ -332,7 +331,7 @@ fail:
(void) fdrelease(l, epp->ep_fd);
} else if (scriptvp) {
vn_lock(scriptvp, LK_EXCLUSIVE | LK_RETRY);
- VOP_CLOSE(scriptvp, FREAD, p->p_cred, l);
+ VOP_CLOSE(scriptvp, FREAD, l->l_cred, l);
vput(scriptvp);
}