Annotation of /tags/mkinitrd-6_3_1/busybox/selinux/setsebool.c
Parent Directory | Revision Log
Revision 1143 -
(hide annotations)
(download)
Thu Aug 19 12:44:27 2010 UTC (14 years, 1 month ago) by niro
File MIME type: text/plain
File size: 792 byte(s)
Thu Aug 19 12:44:27 2010 UTC (14 years, 1 month ago) by niro
File MIME type: text/plain
File size: 792 byte(s)
tagged 'mkinitrd-6_3_1'
1 | niro | 816 | /* |
2 | * setsebool | ||
3 | * Simple setsebool | ||
4 | * NOTE: -P option requires libsemanage, so this feature is | ||
5 | * omitted in this version | ||
6 | * Yuichi Nakamura <ynakam@hitachisoft.jp> | ||
7 | niro | 984 | * |
8 | * Licensed under GPLv2, see file LICENSE in this tarball for details. | ||
9 | niro | 816 | */ |
10 | |||
11 | #include "libbb.h" | ||
12 | |||
13 | int setsebool_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | ||
14 | int setsebool_main(int argc, char **argv) | ||
15 | { | ||
16 | char *p; | ||
17 | int value; | ||
18 | |||
19 | if (argc != 3) | ||
20 | bb_show_usage(); | ||
21 | |||
22 | p = argv[2]; | ||
23 | |||
24 | if (LONE_CHAR(p, '1') || strcasecmp(p, "true") == 0 || strcasecmp(p, "on") == 0) { | ||
25 | value = 1; | ||
26 | } else if (LONE_CHAR(p, '0') || strcasecmp(p, "false") == 0 || strcasecmp(p, "off") == 0) { | ||
27 | value = 0; | ||
28 | } else { | ||
29 | bb_show_usage(); | ||
30 | } | ||
31 | |||
32 | if (security_set_boolean(argv[1], value) < 0) | ||
33 | bb_error_msg_and_die("can't set boolean"); | ||
34 | |||
35 | return 0; | ||
36 | } |