Last change
on this file since 3633 was 1765, checked in by Bruno Cornec, 17 years ago |
Update to busybox 1.7.2
|
-
Property svn:eol-style
set to
native
|
File size:
773 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * setenforce
|
---|
3 | *
|
---|
4 | * Based on libselinux 1.33.1
|
---|
5 | * Port to BusyBox Hiroshi Shinji <shiroshi@my.email.ne.jp>
|
---|
6 | *
|
---|
7 | */
|
---|
8 |
|
---|
9 | #include "libbb.h"
|
---|
10 |
|
---|
11 | /* These strings are arranged so that odd ones
|
---|
12 | * result in security_setenforce(1) being done,
|
---|
13 | * the rest will do security_setenforce(0) */
|
---|
14 | static const char *const setenforce_cmd[] = {
|
---|
15 | "0",
|
---|
16 | "1",
|
---|
17 | "permissive",
|
---|
18 | "enforcing",
|
---|
19 | NULL,
|
---|
20 | };
|
---|
21 |
|
---|
22 | int setenforce_main(int argc, char **argv);
|
---|
23 | int setenforce_main(int argc, char **argv)
|
---|
24 | {
|
---|
25 | int i, rc;
|
---|
26 |
|
---|
27 | if (argc != 2)
|
---|
28 | bb_show_usage();
|
---|
29 |
|
---|
30 | selinux_or_die();
|
---|
31 |
|
---|
32 | for (i = 0; setenforce_cmd[i]; i++) {
|
---|
33 | if (strcasecmp(argv[1], setenforce_cmd[i]) != 0)
|
---|
34 | continue;
|
---|
35 | rc = security_setenforce(i & 1);
|
---|
36 | if (rc < 0)
|
---|
37 | bb_perror_msg_and_die("setenforce() failed");
|
---|
38 | return 0;
|
---|
39 | }
|
---|
40 |
|
---|
41 | bb_show_usage();
|
---|
42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.