summaryrefslogtreecommitdiff
path: root/sys/kern/exec_script.c
diff options
context:
space:
mode:
authorelad <elad@NetBSD.org>2005-06-26 19:58:29 +0000
committerelad <elad@NetBSD.org>2005-06-26 19:58:29 +0000
commit8ebc2e9beec6e592b40d97596776d080e2b3b63c (patch)
tree0c442dbf5206a8f6ab380feb292791074a7400ed /sys/kern/exec_script.c
parent5b718ea54c145b7e760d67177c40cc8d02dfe719 (diff)
From marius@openbsd:
Add an exec message so that whenever a set-uid/gid process executes a new image which we may control, the exec does not go by unnoticed.
Diffstat (limited to 'sys/kern/exec_script.c')
-rw-r--r--sys/kern/exec_script.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c
index 4b2dc1bd161..36a93503dc7 100644
--- a/sys/kern/exec_script.c
+++ b/sys/kern/exec_script.c
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_script.c,v 1.39 2005/05/19 20:16:19 elad Exp $ */
+/* $NetBSD: exec_script.c,v 1.40 2005/06/26 19:58:29 elad 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.39 2005/05/19 20:16:19 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.40 2005/06/26 19:58:29 elad Exp $");
#if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
#define FDSCRIPTS /* Need this for safe set-id scripts. */
@@ -56,6 +56,10 @@ __KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.39 2005/05/19 20:16:19 elad Exp $"
#include <sys/verified_exec.h>
+#ifdef SYSTRACE
+#include <sys/systrace.h>
+#endif /* SYSTRACE */
+
/*
* exec_script_makecmds(): Check if it's an executable shell script.
*
@@ -225,8 +229,13 @@ check_shell:
if ((epp->ep_flags & EXEC_HASFD) == 0) {
#endif
/* normally can't fail, but check for it if diagnostic */
+#ifdef SYSTRACE
+ error = copystr(epp->ep_name, *tmpsap++, MAXPATHLEN,
+ (size_t *)0);
+#else
error = copyinstr(epp->ep_name, *tmpsap++, MAXPATHLEN,
(size_t *)0);
+#endif /* SYSTRACE */
#ifdef DIAGNOSTIC
if (error != 0)
panic("exec_script: copyinstr couldn't fail");