coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ls: with -Z, show SMACK security context


From: Jarkko Sakkinen
Subject: Re: [PATCH] ls: with -Z, show SMACK security context
Date: Tue, 25 Jun 2013 09:01:45 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

On 24.06.2013 22:47, Pádraig Brady wrote:
On 06/24/2013 12:34 PM, Pádraig Brady wrote:
On 06/24/2013 12:24 PM, Jarkko Sakkinen wrote:
From: Jarkko Sakkinen <address@hidden>

Enable showing of file SMACK security with '-Z' command-line switch
if SMACK is enabled. Showing SMACK context of a file does not stricly
require SMACK to be enabled but this required to make choice whether to
show SELinux or SMACK security context.

* src/ls.c: output SMACK context with '-Z' switch.
* src/local.mk: link libsmack to 'ls'.
Looks good.
I'll apply after a few make syntax-check adjustments.
pushed with these changes...

Looks good to me.

Thanks
/Jarkko


diff --git a/src/ls.c b/src/ls.c
index 5c8fa71..ea4b3dd 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -117,7 +117,6 @@

  #ifdef HAVE_SMACK
  # include <sys/smack.h>
-# include <attr/xattr.h>
  #endif

  #define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \
@@ -2762,12 +2761,14 @@ free_ent (struct fileinfo *f)
    free (f->name);
    free (f->linkname);
    if (f->scontext != UNKNOWN_SECURITY_CONTEXT)
+    {
  #ifdef HAVE_SMACK
-    if (smack_smackfs_path ())
-      free(f->scontext);
-    else
+      if (smack_smackfs_path ())
+        free (f->scontext);
+      else
  #endif
-      freecon (f->scontext);
+        freecon (f->scontext);
+    }
  }

  /* Empty the table of files.  */
diff --git a/NEWS b/NEWS
index b728ec0..3206385 100644
--- a/NEWS
+++ b/NEWS
@@ -29,7 +29,7 @@ GNU coreutils NEWS                                    -*- 
outline -*-

  ** New features

-  id -Z reports the SMACK security context where available.
+  ls -Z and id -Z report the SMACK security context where available.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]