Integration of Smack LSM in toybox
authorxroche <xavier.roche@open.eurogiciel.org>
Mon, 13 Oct 2014 14:09:05 +0000 (16:09 +0200)
committerJosé Bollo <jose.bollo@open.eurogiciel.org>
Tue, 31 Mar 2015 12:32:25 +0000 (14:32 +0200)
Link against libattr and libsmack.

Change-Id: I8602077c69376c0a88f534a0514bf96dbd4a209e
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
scripts/make.sh
toys/lsb/mknod.c
toys/pending/ps.c
toys/posix/cp.c
toys/posix/id.c
toys/posix/ls.c
toys/posix/mkdir.c
toys/posix/mkfifo.c

index 4cb1927..6a137d5 100755 (executable)
@@ -9,6 +9,12 @@ source ./configure
 
 [ -z "$KCONFIG_CONFIG" ] && KCONFIG_CONFIG=".config"
 
+if [ ! -z "$USE_SMACK" ]
+then
+  echo "Using Smack"
+  CFLAGS="$CFLAGS -DUSE_SMACK"
+fi
+
 # Since each cc invocation is short, launch half again as many processes
 # as we have processors so they don't exit faster than we can start them.
 [ -z "$CPUS" ] &&
@@ -90,7 +96,7 @@ then
   # for it.
 
   > generated/optlibs.dat
-  for i in util crypt m resolv selinux
+  for i in util crypt m resolv selinux smack attr
   do
     echo "int main(int argc, char *argv[]) {return 0;}" | \
     ${CROSS_COMPILE}${CC} $CFLAGS -xc - -o /dev/null -Wl,--as-needed -l$i > /dev/null 2>/dev/null &&
index 35a127d..ae6876a 100644 (file)
@@ -21,6 +21,10 @@ config MKNOD
 #define FOR_mknod
 #include "toys.h"
 
+#ifdef USE_SMACK
+#include <sys/smack.h>
+#endif //USE_SMACK
+
 GLOBALS(
   char *m;
 )
index 3427557..43db01e 100644 (file)
@@ -24,6 +24,10 @@ config PS
 #define FOR_ps
 #include "toys.h"
 
+#ifdef USE_SMACK
+#include <sys/smack.h>
+#endif //USE_SMACK
+
 GLOBALS(
   struct arg_list *llist_o;
   unsigned screen_width;
index 2959f67..0502c25 100644 (file)
@@ -86,6 +86,10 @@ config INSTALL
 #define FOR_cp
 #include "toys.h"
 
+#ifdef USE_SMACK
+#include <sys/smack.h>
+#endif //USE_SMACK
+
 GLOBALS(
   // install's options
   char *group;
index 353aa04..c3fe609 100644 (file)
@@ -62,6 +62,10 @@ config WHOAMI
 #define FOR_id
 #include "toys.h"
 
+#ifdef USE_SMACK
+#include <sys/smack.h>
+#endif //USE_SMACK
+
 GLOBALS(
   int do_u, do_n, do_G, do_Z, is_groups;
 )
index a924137..aba56e6 100644 (file)
@@ -47,6 +47,10 @@ config LS_COLOR
 #define FOR_ls
 #include "toys.h"
 
+#ifdef USE_SMACK
+#include <sys/smack.h>
+#endif //USE_SMACK
+
 // test sst output (suid/sticky in ls flaglist)
 
 // ls -lR starts .: then ./subdir:
index 739f961..4c39ae0 100644 (file)
@@ -22,6 +22,10 @@ config MKDIR
 #define FOR_mkdir
 #include "toys.h"
 
+#ifdef USE_SMACK
+#include <sys/smack.h>
+#endif //USE_SMACK
+
 GLOBALS(
   char *arg_mode;
 )
index 15fab70..ea1fe30 100644 (file)
@@ -18,6 +18,10 @@ config MKFIFO
 #define FOR_mkfifo
 #include "toys.h"
 
+#ifdef USE_SMACK
+#include <sys/smack.h>
+#endif //USE_SMACK
+
 GLOBALS(
   char *m_string;
   mode_t mode;