Magellan Linux

Contents of /tags/mkinitrd-6_1_4/busybox/selinux/setsebool.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 896 - (show annotations) (download)
Wed Aug 5 16:25:39 2009 UTC (14 years, 10 months ago) by niro
File MIME type: text/plain
File size: 718 byte(s)
tagged 'mkinitrd-6_1_4'
1 /*
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 */
8
9 #include "libbb.h"
10
11 int setsebool_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
12 int setsebool_main(int argc, char **argv)
13 {
14 char *p;
15 int value;
16
17 if (argc != 3)
18 bb_show_usage();
19
20 p = argv[2];
21
22 if (LONE_CHAR(p, '1') || strcasecmp(p, "true") == 0 || strcasecmp(p, "on") == 0) {
23 value = 1;
24 } else if (LONE_CHAR(p, '0') || strcasecmp(p, "false") == 0 || strcasecmp(p, "off") == 0) {
25 value = 0;
26 } else {
27 bb_show_usage();
28 }
29
30 if (security_set_boolean(argv[1], value) < 0)
31 bb_error_msg_and_die("can't set boolean");
32
33 return 0;
34 }