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