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...
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.