[BusyBox-cvs] busybox/libbb find_pid_by_name.c, 1.10, 1.11 procps.c, 1.7, 1.8 run_shell.c, 1.4, 1.5
Erik Andersen
andersen at busybox.net
Thu Jul 3 10:07:35 UTC 2003
Update of /var/cvs/busybox/libbb
In directory winder:/tmp/cvs-serv27387/libbb
Modified Files:
find_pid_by_name.c procps.c run_shell.c
Log Message:
Patch from Russell Coker:
I've attached my latest SE Linux patch for busybox against the latest CVS
version of busybox.
Index: find_pid_by_name.c
===================================================================
RCS file: /var/cvs/busybox/libbb/find_pid_by_name.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- find_pid_by_name.c 26 May 2003 18:06:20 -0000 1.10
+++ find_pid_by_name.c 3 Jul 2003 10:07:01 -0000 1.11
@@ -41,7 +41,11 @@
procps_status_t * p;
pidList = xmalloc(sizeof(long));
+#ifdef CONFIG_SELINUX
+ while ((p = procps_scan(0, 0, NULL)) != 0) {
+#else
while ((p = procps_scan(0)) != 0) {
+#endif
if (strcmp(p->short_cmd, pidName) == 0) {
pidList=xrealloc( pidList, sizeof(long) * (i+2));
pidList[i++]=p->pid;
Index: procps.c
===================================================================
RCS file: /var/cvs/busybox/libbb/procps.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- procps.c 26 May 2003 18:07:30 -0000 1.7
+++ procps.c 3 Jul 2003 10:07:01 -0000 1.8
@@ -16,7 +16,11 @@
#include "libbb.h"
-extern procps_status_t * procps_scan(int save_user_arg0)
+extern procps_status_t * procps_scan(int save_user_arg0
+#ifdef CONFIG_SELINUX
+ , int use_selinux , security_id_t *sid
+#endif
+ )
{
static DIR *dir;
struct dirent *entry;
@@ -53,6 +57,14 @@
sprintf(status, "/proc/%d/stat", pid);
if((fp = fopen(status, "r")) == NULL)
continue;
+#ifdef CONFIG_SELINUX
+ if(use_selinux)
+ {
+ if(fstat_secure(fileno(fp), &sb, sid))
+ continue;
+ }
+ else
+#endif
if(fstat(fileno(fp), &sb))
continue;
my_getpwuid(curstatus.user, sb.st_uid);
Index: run_shell.c
===================================================================
RCS file: /var/cvs/busybox/libbb/run_shell.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- run_shell.c 26 May 2003 14:06:00 -0000 1.4
+++ run_shell.c 3 Jul 2003 10:07:01 -0000 1.5
@@ -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 @@
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 );
}
More information about the busybox-cvs
mailing list