summaryrefslogtreecommitdiff
path: root/sys/kern/exec_script.c
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2010-11-19 06:44:33 +0000
committerdholland <dholland@NetBSD.org>2010-11-19 06:44:33 +0000
commit8f6ed30d57969451cf6dee44963bdbfad19bea01 (patch)
tree4d7f4fee51c9f0d03aeb78a6de5fe56a3a096106 /sys/kern/exec_script.c
parent0ce666ede04fa90ffe8633b9bd63f0454d2c09ff (diff)
Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now create a pathbuf and pass it to NDINIT (instead of a string and a uio_seg), then destroy the pathbuf after the namei session is complete. Update all namei call sites accordingly. Add a pathbuf(9) man page and update namei(9). The pathbuf interface also now appears in a couple of related additional places that were passing string/uio_seg pairs that were later fed into NDINIT. Update other call sites accordingly.
Diffstat (limited to 'sys/kern/exec_script.c')
-rw-r--r--sys/kern/exec_script.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c
index 108e2a226dd..05210752355 100644
--- a/sys/kern/exec_script.c
+++ b/sys/kern/exec_script.c
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_script.c,v 1.65 2010/06/24 13:03:11 hannken Exp $ */
+/* $NetBSD: exec_script.c,v 1.66 2010/11/19 06:44:42 dholland 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.65 2010/06/24 13:03:11 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.66 2010/11/19 06:44:42 dholland Exp $");
#if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
#define FDSCRIPTS /* Need this for safe set-id scripts. */
@@ -119,6 +119,7 @@ exec_script_makecmds(struct lwp *l, struct exec_package *epp)
size_t shellargp_len;
struct exec_fakearg *shellargp;
struct exec_fakearg *tmpsap;
+ struct pathbuf *shell_pathbuf;
struct vnode *scriptvp;
#ifdef SETUIDSCRIPTS
/* Gcc needs those initialized for spurious uninitialized warning */
@@ -296,7 +297,13 @@ check_shell:
epp->ep_hdrvalid = 0;
/* try loading the interpreter */
- error = check_exec(l, epp, shellname);
+ shell_pathbuf = pathbuf_create(shellname);
+ if (shell_pathbuf == NULL) {
+ error = ENOMEM;
+ } else {
+ error = check_exec(l, epp, shell_pathbuf);
+ pathbuf_destroy(shell_pathbuf);
+ }
/* note that we've clobbered the header */
epp->ep_flags |= EXEC_DESTR;