aboutsummaryrefslogtreecommitdiff
path: root/libbb/run_shell.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-03 10:07:04 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-03 10:07:04 +0000
commit058ac4543d7d9b3acec3dd992df07d460484742e (patch)
treee8f993dffc34380fbcc54cc858c81da594bdb95b /libbb/run_shell.c
parent6b9670aadfe6d16099d630f89862239bb0c59e7c (diff)
downloadbusybox-w32-058ac4543d7d9b3acec3dd992df07d460484742e.tar.gz
busybox-w32-058ac4543d7d9b3acec3dd992df07d460484742e.tar.bz2
busybox-w32-058ac4543d7d9b3acec3dd992df07d460484742e.zip
Patch from Russell Coker:
I've attached my latest SE Linux patch for busybox against the latest CVS version of busybox. git-svn-id: svn://busybox.net/trunk/busybox@7031 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 @@
36#include <syslog.h> 36#include <syslog.h>
37#include <ctype.h> 37#include <ctype.h>
38#include "libbb.h" 38#include "libbb.h"
39 39#ifdef CONFIG_SELINUX
40#include <proc_secure.h>
41#endif
40 42
41/* Run SHELL, or DEFAULT_SHELL if SHELL is empty. 43/* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
42 If COMMAND is nonzero, pass it to the shell with the -c option. 44 If COMMAND is nonzero, pass it to the shell with the -c option.
43 If ADDITIONAL_ARGS is nonzero, pass it to the shell as more 45 If ADDITIONAL_ARGS is nonzero, pass it to the shell as more
44 arguments. */ 46 arguments. */
45 47
46void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args ) 48void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args
49#ifdef CONFIG_SELINUX
50 , security_id_t sid
51#endif
52)
47{ 53{
48 const char **args; 54 const char **args;
49 int argno = 1; 55 int argno = 1;
@@ -71,6 +77,11 @@ void run_shell ( const char *shell, int loginshell, const char *command, const c
71 args [argno++] = *additional_args; 77 args [argno++] = *additional_args;
72 } 78 }
73 args [argno] = 0; 79 args [argno] = 0;
80#ifdef CONFIG_SELINUX
81 if(sid)
82 execve_secure(shell, (char **) args, environ, sid);
83 else
84#endif
74 execv ( shell, (char **) args ); 85 execv ( shell, (char **) args );
75 bb_perror_msg_and_die ( "cannot run %s", shell ); 86 bb_perror_msg_and_die ( "cannot run %s", shell );
76} 87}