From bac96c8c70e2b37362090cb1ffc96aa54c160bca Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Mon, 11 Jun 2012 13:19:00 -0400 Subject: [PATCH] libselinux: getsebool: support boolean name substitution Use selinux_boolean_sub to translate the boolean name handed in by the user. Report back the correct name of the boolean. Signed-off-by: Eric Paris --- libselinux/utils/getsebool.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libselinux/utils/getsebool.c b/libselinux/utils/getsebool.c index 3a904498..9ae92430 100644 --- a/libselinux/utils/getsebool.c +++ b/libselinux/utils/getsebool.c @@ -87,14 +87,22 @@ int main(int argc, char **argv) rc = -1; goto out; } + char *alt_name = selinux_boolean_sub(names[i]); + if (! alt_name) { + perror("Out of memory\n"); + rc = -1; + goto out; + } + if (pending != active) { - printf("%s --> %s pending: %s\n", names[i], + printf("%s --> %s pending: %s\n", alt_name, (active ? "on" : "off"), (pending ? "on" : "off")); } else { - printf("%s --> %s\n", names[i], + printf("%s --> %s\n", alt_name, (active ? "on" : "off")); } + free(alt_name); } out: