diff options
author | Dan Walsh <dwalsh@redhat.com> | 2012-06-11 13:19:00 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2012-09-12 13:14:29 -0400 |
commit | bac96c8c70e2b37362090cb1ffc96aa54c160bca (patch) | |
tree | a2dc97fb213d43370c44accdc1a4d32e14f4e9df /libselinux/utils/getsebool.c | |
parent | 88c35241535803247bd3044187c6c3b3c7f02c79 (diff) | |
download | android_external_selinux-bac96c8c70e2b37362090cb1ffc96aa54c160bca.tar.gz android_external_selinux-bac96c8c70e2b37362090cb1ffc96aa54c160bca.tar.bz2 android_external_selinux-bac96c8c70e2b37362090cb1ffc96aa54c160bca.zip |
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 <eparis@redhat.com>
Diffstat (limited to 'libselinux/utils/getsebool.c')
-rw-r--r-- | libselinux/utils/getsebool.c | 12 |
1 files 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: |