[SM-Commit] GIT changes to master grimoire by Juuso Alasuutari (4b3ac71fdbbb0b4884f4b0475470391eedcc3ae6)

Juuso Alasuutari scm at sourcemage.org
Mon Feb 16 17:37:49 EST 2009


GIT changes to master grimoire by Juuso Alasuutari <iuso at sourcemage.org>:

 utils/coreutils/CONFIGURE             |    3 -
 utils/coreutils/HISTORY               |    4 +
 utils/coreutils/PRE_BUILD             |    6 +-
 utils/coreutils/coreutils-smack.patch |   91 ++++++++++++++++++++++++++++++++++
 4 files changed, 102 insertions(+), 2 deletions(-)

New commits:
commit 4b3ac71fdbbb0b4884f4b0475470391eedcc3ae6
Author: Juuso Alasuutari <iuso at sourcemage.org>
Commit: Juuso Alasuutari <iuso at sourcemage.org>

    coreutils: Add optional Simplified Mandatory Access Control Kernel (SMACK) support.

diff --git a/utils/coreutils/CONFIGURE b/utils/coreutils/CONFIGURE
index 17c8de9..999788c 100755
--- a/utils/coreutils/CONFIGURE
+++ b/utils/coreutils/CONFIGURE
@@ -1 +1,2 @@
-config_query_option SELINUX "Enable SELinux patches?" n "--enable-selinux" ""
+config_query_option SELINUX "Enable SELinux patches?" n "--enable-selinux" "" &&
+config_query SMACK "Enable SMACK patch?" n
diff --git a/utils/coreutils/HISTORY b/utils/coreutils/HISTORY
index 8e1a4f6..0b0be76 100644
--- a/utils/coreutils/HISTORY
+++ b/utils/coreutils/HISTORY
@@ -1,3 +1,7 @@
+2009-02-17 Juuso Alasuutari <iuso at sourcemage.org>
+	* CONFIGURE, PRE_BUILD, coreutils-smack.patch: Add optional
+	  Simplified Mandatory Access Control Kernel (SMACK) support.
+
 2008-06-08 Elisamuel Resto <ryuji at sourcemage.org>
 	* DETAILS: PATCHLEVEL=1
 	* PRE_BUILD, coreutils-utimens.patch: patch that fixes the use of
diff --git a/utils/coreutils/PRE_BUILD b/utils/coreutils/PRE_BUILD
index 739739a..00142be 100755
--- a/utils/coreutils/PRE_BUILD
+++ b/utils/coreutils/PRE_BUILD
@@ -1,3 +1,7 @@
 default_pre_build &&
 cd ${SOURCE_DIRECTORY} &&
-patch -p1 < ${SPELL_DIRECTORY}/coreutils-utimens.patch
+patch -p1 < ${SPELL_DIRECTORY}/coreutils-utimens.patch &&
+
+if [[ $SMACK == y ]]; then
+  patch -p1 < "$SPELL_DIRECTORY/coreutils-smack.patch"
+fi
diff --git a/utils/coreutils/coreutils-smack.patch b/utils/coreutils/coreutils-smack.patch
new file mode 100644
index 0000000..1735d9f
--- /dev/null
+++ b/utils/coreutils/coreutils-smack.patch
@@ -0,0 +1,91 @@
+--- coreutils-6.12/src/ls.c~	2008-05-26 09:40:32.000000000 +0300
++++ coreutils-6.12/src/ls.c	2008-10-26 15:26:27.000000000 +0200
+@@ -37,6 +37,7 @@
+ 
+ #include <config.h>
+ #include <sys/types.h>
++#include <attr/attributes.h>
+ 
+ #if HAVE_TERMIOS_H
+ # include <termios.h>
+@@ -182,6 +183,9 @@
+     /* For long listings, true if the file has an access control list,
+        or an SELinux security context.  */
+     bool have_acl;
++
++    /* Smack label */
++    char smack[8];
+   };
+ 
+ #define LEN_STR_PAIR(s) sizeof (s) - 1, s
+@@ -649,6 +653,10 @@
+ 
+ static bool print_dir_name;
+ 
++/* True means print the SMACK attribute.  */
++
++static bool print_smack;
++
+ /* The line length to use for breaking lines in many-per-line format.
+    Can be set with -w.  */
+ 
+@@ -773,6 +781,7 @@
+   {"ignore", required_argument, NULL, 'I'},
+   {"indicator-style", required_argument, NULL, INDICATOR_STYLE_OPTION},
+   {"dereference", no_argument, NULL, 'L'},
++  {"smack", no_argument, NULL, 'M'},
+   {"literal", no_argument, NULL, 'N'},
+   {"quote-name", no_argument, NULL, 'Q'},
+   {"quoting-style", required_argument, NULL, QUOTING_STYLE_OPTION},
+@@ -1520,7 +1529,7 @@
+     {
+       int oi = -1;
+       int c = getopt_long (argc, argv,
+-			   "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UXZ1",
++			   "abcdfghiklmnopqrstuvw:xABCDFGHI:LMNQRST:UXZ1",
+ 			   long_options, &oi);
+       if (c == -1)
+ 	break;
+@@ -1683,6 +1692,10 @@
+ 	  dereference = DEREF_ALWAYS;
+ 	  break;
+ 
++	case 'M':
++	  print_smack = true;
++	  break;
++
+ 	case 'N':
+ 	  set_quoting_style (NULL, literal_quoting_style);
+ 	  break;
+@@ -2840,6 +2853,18 @@
+ 		file_size_width = len;
+ 	    }
+ 	}
++
++    if (print_smack)
++      {
++        int len = 0;
++        int err = getxattr (absolute_name, "security.SMACK64", f->smack, &len);
++        if (err < 0)
++          {
++perror(absolute_name);
++            f->smack[0] = '?';
++            f->smack[1] = '\0';
++          }
++      }
+     }
+ 
+   if (print_inode)
+@@ -3452,6 +3477,12 @@
+ 
+   p = buf;
+ 
++  if (print_smack)
++    {
++      sprintf(p, "%-8s", f->smack);
++      p += 8;
++    }
++
+   if (print_inode)
+     {
+       char hbuf[INT_BUFSIZE_BOUND (uintmax_t)];



More information about the SM-Commit mailing list