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>
This commit is contained in:
Dan Walsh 2012-06-11 13:19:00 -04:00 committed by Eric Paris
parent 88c3524153
commit bac96c8c70
1 changed files with 10 additions and 2 deletions

View File

@ -87,14 +87,22 @@ int main(int argc, char **argv)
rc = -1; rc = -1;
goto out; 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) { if (pending != active) {
printf("%s --> %s pending: %s\n", names[i], printf("%s --> %s pending: %s\n", alt_name,
(active ? "on" : "off"), (active ? "on" : "off"),
(pending ? "on" : "off")); (pending ? "on" : "off"));
} else { } else {
printf("%s --> %s\n", names[i], printf("%s --> %s\n", alt_name,
(active ? "on" : "off")); (active ? "on" : "off"));
} }
free(alt_name);
} }
out: out: