4 * Based on libselinux 1.33.1
5 * Port to BusyBox Hiroshi Shinji <shiroshi@my.email.ne.jp>
7 * Licensed under GPLv2, see file LICENSE in this source tree.
10 //usage:#define getsebool_trivial_usage
11 //usage: "-a or getsebool boolean..."
12 //usage:#define getsebool_full_usage "\n\n"
13 //usage: " -a Show all selinux booleans"
17 int getsebool_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
18 int getsebool_main(int argc, char **argv)
20 int i, rc = 0, active, pending, len = 0;
25 opt = getopt32(argv, "a");
31 rc = security_get_boolean_names(&names, &len);
33 bb_perror_msg_and_die("can't get boolean names");
45 names = xmalloc(sizeof(char *) * len);
46 for (i = 0; i < len; i++)
47 names[i] = xstrdup(argv[i + 1]);
50 for (i = 0; i < len; i++) {
51 active = security_get_boolean_active(names[i]);
53 bb_error_msg_and_die("error getting active value for %s", names[i]);
55 pending = security_get_boolean_pending(names[i]);
57 bb_error_msg_and_die("error getting pending value for %s", names[i]);
59 printf("%s --> %s", names[i], (active ? "on" : "off"));
60 if (pending != active)
61 printf(" pending: %s", (pending ? "on" : "off"));
65 if (ENABLE_FEATURE_CLEAN_UP) {
66 for (i = 0; i < len; i++)