Last change
on this file since 3504 was 3232, checked in by Bruno Cornec, 11 years ago |
- Update mindi-busybox to 1.21.1
|
-
Property svn:eol-style
set to
native
|
File size:
940 bytes
|
Line | |
---|
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 | * Licensed under GPLv2, see file LICENSE in this source tree.
|
---|
9 | */
|
---|
10 |
|
---|
11 | //usage:#define setsebool_trivial_usage
|
---|
12 | //usage: "boolean value"
|
---|
13 | //usage:#define setsebool_full_usage "\n\n"
|
---|
14 | //usage: "Change boolean setting"
|
---|
15 |
|
---|
16 | #include "libbb.h"
|
---|
17 |
|
---|
18 | int setsebool_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
19 | int setsebool_main(int argc, char **argv)
|
---|
20 | {
|
---|
21 | char *p;
|
---|
22 | int value;
|
---|
23 |
|
---|
24 | if (argc != 3)
|
---|
25 | bb_show_usage();
|
---|
26 |
|
---|
27 | p = argv[2];
|
---|
28 |
|
---|
29 | if (LONE_CHAR(p, '1') || strcasecmp(p, "true") == 0 || strcasecmp(p, "on") == 0) {
|
---|
30 | value = 1;
|
---|
31 | } else if (LONE_CHAR(p, '0') || strcasecmp(p, "false") == 0 || strcasecmp(p, "off") == 0) {
|
---|
32 | value = 0;
|
---|
33 | } else {
|
---|
34 | bb_show_usage();
|
---|
35 | }
|
---|
36 |
|
---|
37 | if (security_set_boolean(argv[1], value) < 0)
|
---|
38 | bb_error_msg_and_die("can't set boolean");
|
---|
39 |
|
---|
40 | return 0;
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.