From a915d78ef9bccc88a12d63a2c863a3030ee9300e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 8 Feb 2012 18:16:19 +0000 Subject: New API: llz: This runs ls -laZ and is useful for showing SELinux contexts. --- daemon/ls.c | 26 ++++++++++++++++++++++++++ generator/generator_actions.ml | 9 +++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/daemon/ls.c b/daemon/ls.c index d0c7b523..1df0b6a2 100644 --- a/daemon/ls.c +++ b/daemon/ls.c @@ -102,3 +102,29 @@ do_ll (const char *path) free (err); return out; /* caller frees */ } + +char * +do_llz (const char *path) +{ + int r; + char *out, *err; + char *spath; + + spath = sysroot_path (path); + if (!spath) { + reply_with_perror ("malloc"); + return NULL; + } + + r = command (&out, &err, "ls", "-laZ", spath, NULL); + free (spath); + if (r == -1) { + reply_with_error ("%s", err); + free (out); + free (err); + return NULL; + } + + free (err); + return out; /* caller frees */ +} diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 3a7be795..f9ba5c39 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -6651,6 +6651,15 @@ This option may not be specified at the same time as the C option. =back"); + ("llz", (RString "listing", [Pathname "directory"], []), 305, [], + [], + "list the files in a directory (long format with SELinux contexts)", + "\ +List the files in C in the format of 'ls -laZ'. + +This command is mostly useful for interactive sessions. It +is I intended that you try to parse the output string."); + ] let all_functions = non_daemon_functions @ daemon_functions diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 873b744b..67d04b9f 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -304 +305 -- cgit