aboutsummaryrefslogtreecommitdiff
path: root/libbb/run_shell.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-07-03 10:07:04 +0000
committerEric Andersen <andersen@codepoet.org>2003-07-03 10:07:04 +0000
commit9e48045e45df7e3e205575a4eb3dc39d634b05aa (patch)
treee8f993dffc34380fbcc54cc858c81da594bdb95b /libbb/run_shell.c
parentc48d49ad988a4163cff7f38ee4bd1f9886d0ed11 (diff)
downloadbusybox-9e48045e45df7e3e205575a4eb3dc39d634b05aa.tar.gz
Patch from Russell Coker:
I've attached my latest SE Linux patch for busybox against the latest CVS version of busybox.
Diffstat (limited to 'libbb/run_shell.c')
-rw-r--r--libbb/run_shell.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libbb/run_shell.c b/libbb/run_shell.c
index 49e8a76c2..4855d763e 100644
--- a/libbb/run_shell.c
+++ b/libbb/run_shell.c
@@ -36,14 +36,20 @@
#include <syslog.h>
#include <ctype.h>
#include "libbb.h"
-
+#ifdef CONFIG_SELINUX
+#include <proc_secure.h>
+#endif
/* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
If COMMAND is nonzero, pass it to the shell with the -c option.
If ADDITIONAL_ARGS is nonzero, pass it to the shell as more
arguments. */
-void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args )
+void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args
+#ifdef CONFIG_SELINUX
+ , security_id_t sid
+#endif
+)
{
const char **args;
int argno = 1;
@@ -71,6 +77,11 @@ void run_shell ( const char *shell, int loginshell, const char *command, const c
args [argno++] = *additional_args;
}
args [argno] = 0;
+#ifdef CONFIG_SELINUX
+ if(sid)
+ execve_secure(shell, (char **) args, environ, sid);
+ else
+#endif
execv ( shell, (char **) args );
bb_perror_msg_and_die ( "cannot run %s", shell );
}