aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-11-23 18:46:40 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2016-11-23 18:46:40 +0100
commita8e52da7742b2bc8a3993f7f7c3c70da8fe79848 (patch)
tree5ec3c417b56095f6768b6a7c96817c248bdea2fa
parent15fb91cefb22d64952f34fe246fc8f257172af63 (diff)
downloadbusybox-w32-a8e52da7742b2bc8a3993f7f7c3c70da8fe79848.tar.gz
busybox-w32-a8e52da7742b2bc8a3993f7f7c3c70da8fe79848.tar.bz2
busybox-w32-a8e52da7742b2bc8a3993f7f7c3c70da8fe79848.zip
Convert all selinux/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/applets.src.h12
-rw-r--r--selinux/Config.src113
-rw-r--r--selinux/Kbuild.src12
-rw-r--r--selinux/chcon.c17
-rw-r--r--selinux/getenforce.c10
-rw-r--r--selinux/getsebool.c10
-rw-r--r--selinux/load_policy.c10
-rw-r--r--selinux/matchpathcon.c11
-rw-r--r--selinux/runcon.c17
-rw-r--r--selinux/selinuxenabled.c11
-rw-r--r--selinux/sestatus.c10
-rw-r--r--selinux/setenforce.c10
-rw-r--r--selinux/setfiles.c31
-rw-r--r--selinux/setsebool.c11
14 files changed, 148 insertions, 137 deletions
diff --git a/include/applets.src.h b/include/applets.src.h
index c72dca849..4e789151d 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -73,25 +73,13 @@ s - suid type:
73 73
74 74
75INSERT 75INSERT
76IF_CHCON(APPLET(chcon, BB_DIR_USR_BIN, BB_SUID_DROP))
77IF_DHCPRELAY(APPLET(dhcprelay, BB_DIR_USR_SBIN, BB_SUID_DROP)) 76IF_DHCPRELAY(APPLET(dhcprelay, BB_DIR_USR_SBIN, BB_SUID_DROP))
78IF_DUMPLEASES(APPLET(dumpleases, BB_DIR_USR_BIN, BB_SUID_DROP)) 77IF_DUMPLEASES(APPLET(dumpleases, BB_DIR_USR_BIN, BB_SUID_DROP))
79//IF_E2FSCK(APPLET(e2fsck, BB_DIR_SBIN, BB_SUID_DROP)) 78//IF_E2FSCK(APPLET(e2fsck, BB_DIR_SBIN, BB_SUID_DROP))
80//IF_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, BB_DIR_SBIN, BB_SUID_DROP, e2label)) 79//IF_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, BB_DIR_SBIN, BB_SUID_DROP, e2label))
81//IF_E2FSCK(APPLET_ODDNAME(fsck.ext2, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext2)) 80//IF_E2FSCK(APPLET_ODDNAME(fsck.ext2, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext2))
82//IF_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext3)) 81//IF_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext3))
83IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
84IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
85IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP))
86IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP))
87//IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP)) 82//IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP))
88IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon))
89IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP))
90IF_SELINUXENABLED(APPLET(selinuxenabled, BB_DIR_USR_SBIN, BB_SUID_DROP))
91IF_SESTATUS(APPLET(sestatus, BB_DIR_USR_SBIN, BB_SUID_DROP))
92IF_SETENFORCE(APPLET(setenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
93IF_SETFILES(APPLET(setfiles, BB_DIR_SBIN, BB_SUID_DROP))
94IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
95IF_UDHCPC(APPLET(udhcpc, BB_DIR_SBIN, BB_SUID_DROP)) 83IF_UDHCPC(APPLET(udhcpc, BB_DIR_SBIN, BB_SUID_DROP))
96IF_UDHCPD(APPLET(udhcpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) 84IF_UDHCPD(APPLET(udhcpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
97 85
diff --git a/selinux/Config.src b/selinux/Config.src
index d4701f60b..9cb755a0f 100644
--- a/selinux/Config.src
+++ b/selinux/Config.src
@@ -8,117 +8,4 @@ menu "SELinux Utilities"
8 8
9INSERT 9INSERT
10 10
11config CHCON
12 bool "chcon"
13 default n
14 depends on SELINUX
15 help
16 Enable support to change the security context of file.
17
18config FEATURE_CHCON_LONG_OPTIONS
19 bool "Enable long options"
20 default y
21 depends on CHCON && LONG_OPTS
22 help
23 Support long options for the chcon applet.
24
25config GETENFORCE
26 bool "getenforce"
27 default n
28 depends on SELINUX
29 help
30 Enable support to get the current mode of SELinux.
31
32config GETSEBOOL
33 bool "getsebool"
34 default n
35 depends on SELINUX
36 help
37 Enable support to get SELinux boolean values.
38
39config LOAD_POLICY
40 bool "load_policy"
41 default n
42 depends on SELINUX
43 help
44 Enable support to load SELinux policy.
45
46config MATCHPATHCON
47 bool "matchpathcon"
48 default n
49 depends on SELINUX
50 help
51 Enable support to get default security context of the
52 specified path from the file contexts configuration.
53
54config RESTORECON
55 bool "restorecon"
56 default n
57 depends on SELINUX
58 help
59 Enable support to relabel files. The feature is almost
60 the same as setfiles, but usage is a little different.
61
62config RUNCON
63 bool "runcon"
64 default n
65 depends on SELINUX
66 help
67 Enable support to run command in specified security context.
68
69config FEATURE_RUNCON_LONG_OPTIONS
70 bool "Enable long options"
71 default y
72 depends on RUNCON && LONG_OPTS
73 help
74 Support long options for the runcon applet.
75
76config SELINUXENABLED
77 bool "selinuxenabled"
78 default n
79 depends on SELINUX
80 help
81 Enable support for this command to be used within shell scripts
82 to determine if selinux is enabled.
83
84config SETENFORCE
85 bool "setenforce"
86 default n
87 depends on SELINUX
88 help
89 Enable support to modify the mode SELinux is running in.
90
91config SETFILES
92 bool "setfiles"
93 default n
94 depends on SELINUX
95 help
96 Enable support to modify to relabel files.
97 Notice: If you built libselinux with -D_FILE_OFFSET_BITS=64,
98 (It is default in libselinux's Makefile), you _must_ enable
99 CONFIG_LFS.
100
101config FEATURE_SETFILES_CHECK_OPTION
102 bool "Enable check option"
103 default n
104 depends on SETFILES
105 help
106 Support "-c" option (check the validity of the contexts against
107 the specified binary policy) for setfiles. Requires libsepol.
108
109config SETSEBOOL
110 bool "setsebool"
111 default n
112 depends on SELINUX
113 help
114 Enable support for change boolean.
115 semanage and -P option is not supported yet.
116
117config SESTATUS
118 bool "sestatus"
119 default n
120 depends on SELINUX
121 help
122 Displays the status of SELinux.
123
124endmenu 11endmenu
diff --git a/selinux/Kbuild.src b/selinux/Kbuild.src
index cdd5f2adf..62c9e64cd 100644
--- a/selinux/Kbuild.src
+++ b/selinux/Kbuild.src
@@ -8,15 +8,3 @@
8lib-y:= 8lib-y:=
9 9
10INSERT 10INSERT
11lib-$(CONFIG_CHCON) += chcon.o
12lib-$(CONFIG_GETENFORCE) += getenforce.o
13lib-$(CONFIG_GETSEBOOL) += getsebool.o
14lib-$(CONFIG_LOAD_POLICY) += load_policy.o
15lib-$(CONFIG_MATCHPATHCON) += matchpathcon.o
16lib-$(CONFIG_RUNCON) += runcon.o
17lib-$(CONFIG_SELINUXENABLED) += selinuxenabled.o
18lib-$(CONFIG_SETENFORCE) += setenforce.o
19lib-$(CONFIG_SETFILES) += setfiles.o
20lib-$(CONFIG_RESTORECON) += setfiles.o
21lib-$(CONFIG_SETSEBOOL) += setsebool.o
22lib-$(CONFIG_SESTATUS) += sestatus.o
diff --git a/selinux/chcon.c b/selinux/chcon.c
index f947c2c12..c743013ce 100644
--- a/selinux/chcon.c
+++ b/selinux/chcon.c
@@ -7,6 +7,23 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config CHCON
11//config: bool "chcon"
12//config: default n
13//config: depends on SELINUX
14//config: help
15//config: Enable support to change the security context of file.
16//config:
17//config:config FEATURE_CHCON_LONG_OPTIONS
18//config: bool "Enable long options"
19//config: default y
20//config: depends on CHCON && LONG_OPTS
21//config: help
22//config: Support long options for the chcon applet.
23
24//applet:IF_CHCON(APPLET(chcon, BB_DIR_USR_BIN, BB_SUID_DROP))
25
26//kbuild:lib-$(CONFIG_CHCON) += chcon.o
10 27
11//usage:#define chcon_trivial_usage 28//usage:#define chcon_trivial_usage
12//usage: "[OPTIONS] CONTEXT FILE..." 29//usage: "[OPTIONS] CONTEXT FILE..."
diff --git a/selinux/getenforce.c b/selinux/getenforce.c
index 56611d693..37477652b 100644
--- a/selinux/getenforce.c
+++ b/selinux/getenforce.c
@@ -6,6 +6,16 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config GETENFORCE
10//config: bool "getenforce"
11//config: default n
12//config: depends on SELINUX
13//config: help
14//config: Enable support to get the current mode of SELinux.
15
16//applet:IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_GETENFORCE) += getenforce.o
9 19
10//usage:#define getenforce_trivial_usage NOUSAGE_STR 20//usage:#define getenforce_trivial_usage NOUSAGE_STR
11//usage:#define getenforce_full_usage "" 21//usage:#define getenforce_full_usage ""
diff --git a/selinux/getsebool.c b/selinux/getsebool.c
index e8f0fefb0..fce478f5b 100644
--- a/selinux/getsebool.c
+++ b/selinux/getsebool.c
@@ -6,6 +6,16 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config GETSEBOOL
10//config: bool "getsebool"
11//config: default n
12//config: depends on SELINUX
13//config: help
14//config: Enable support to get SELinux boolean values.
15
16//applet:IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_GETSEBOOL) += getsebool.o
9 19
10//usage:#define getsebool_trivial_usage 20//usage:#define getsebool_trivial_usage
11//usage: "-a or getsebool boolean..." 21//usage: "-a or getsebool boolean..."
diff --git a/selinux/load_policy.c b/selinux/load_policy.c
index ce139dbf2..f969453e3 100644
--- a/selinux/load_policy.c
+++ b/selinux/load_policy.c
@@ -4,6 +4,16 @@
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this source tree. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7//config:config LOAD_POLICY
8//config: bool "load_policy"
9//config: default n
10//config: depends on SELINUX
11//config: help
12//config: Enable support to load SELinux policy.
13
14//applet:IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP))
15
16//kbuild:lib-$(CONFIG_LOAD_POLICY) += load_policy.o
7 17
8//usage:#define load_policy_trivial_usage NOUSAGE_STR 18//usage:#define load_policy_trivial_usage NOUSAGE_STR
9//usage:#define load_policy_full_usage "" 19//usage:#define load_policy_full_usage ""
diff --git a/selinux/matchpathcon.c b/selinux/matchpathcon.c
index 9e5728eb3..a3b2fcb74 100644
--- a/selinux/matchpathcon.c
+++ b/selinux/matchpathcon.c
@@ -5,6 +5,17 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8//config:config MATCHPATHCON
9//config: bool "matchpathcon"
10//config: default n
11//config: depends on SELINUX
12//config: help
13//config: Enable support to get default security context of the
14//config: specified path from the file contexts configuration.
15
16//applet:IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_MATCHPATHCON) += matchpathcon.o
8 19
9//usage:#define matchpathcon_trivial_usage 20//usage:#define matchpathcon_trivial_usage
10//usage: "[-n] [-N] [-f file_contexts_file] [-p prefix] [-V]" 21//usage: "[-n] [-N] [-f file_contexts_file] [-p prefix] [-V]"
diff --git a/selinux/runcon.c b/selinux/runcon.c
index 27f2be3a9..366834e46 100644
--- a/selinux/runcon.c
+++ b/selinux/runcon.c
@@ -28,6 +28,23 @@
28 * 28 *
29 * Licensed under GPLv2, see file LICENSE in this source tree. 29 * Licensed under GPLv2, see file LICENSE in this source tree.
30 */ 30 */
31//config:config RUNCON
32//config: bool "runcon"
33//config: default n
34//config: depends on SELINUX
35//config: help
36//config: Enable support to run command in specified security context.
37//config:
38//config:config FEATURE_RUNCON_LONG_OPTIONS
39//config: bool "Enable long options"
40//config: default y
41//config: depends on RUNCON && LONG_OPTS
42//config: help
43//config: Support long options for the runcon applet.
44
45//applet:IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP))
46
47//kbuild:lib-$(CONFIG_RUNCON) += runcon.o
31 48
32//usage:#define runcon_trivial_usage 49//usage:#define runcon_trivial_usage
33//usage: "[-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] PROG ARGS\n" 50//usage: "[-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] PROG ARGS\n"
diff --git a/selinux/selinuxenabled.c b/selinux/selinuxenabled.c
index ce830dc22..b80c4e71b 100644
--- a/selinux/selinuxenabled.c
+++ b/selinux/selinuxenabled.c
@@ -6,6 +6,17 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config SELINUXENABLED
10//config: bool "selinuxenabled"
11//config: default n
12//config: depends on SELINUX
13//config: help
14//config: Enable support for this command to be used within shell scripts
15//config: to determine if selinux is enabled.
16
17//applet:IF_SELINUXENABLED(APPLET(selinuxenabled, BB_DIR_USR_SBIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_SELINUXENABLED) += selinuxenabled.o
9 20
10//usage:#define selinuxenabled_trivial_usage NOUSAGE_STR 21//usage:#define selinuxenabled_trivial_usage NOUSAGE_STR
11//usage:#define selinuxenabled_full_usage "" 22//usage:#define selinuxenabled_full_usage ""
diff --git a/selinux/sestatus.c b/selinux/sestatus.c
index e59431873..ad49c9d25 100644
--- a/selinux/sestatus.c
+++ b/selinux/sestatus.c
@@ -7,6 +7,16 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config SESTATUS
11//config: bool "sestatus"
12//config: default n
13//config: depends on SELINUX
14//config: help
15//config: Displays the status of SELinux.
16
17//applet:IF_SESTATUS(APPLET(sestatus, BB_DIR_USR_SBIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_SESTATUS) += sestatus.o
10 20
11//usage:#define sestatus_trivial_usage 21//usage:#define sestatus_trivial_usage
12//usage: "[-vb]" 22//usage: "[-vb]"
diff --git a/selinux/setenforce.c b/selinux/setenforce.c
index c5bc0a5a6..8d18abd29 100644
--- a/selinux/setenforce.c
+++ b/selinux/setenforce.c
@@ -6,6 +6,16 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config SETENFORCE
10//config: bool "setenforce"
11//config: default n
12//config: depends on SELINUX
13//config: help
14//config: Enable support to modify the mode SELinux is running in.
15
16//applet:IF_SETENFORCE(APPLET(setenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_SETENFORCE) += setenforce.o
9 19
10//usage:#define setenforce_trivial_usage 20//usage:#define setenforce_trivial_usage
11//usage: "[Enforcing | Permissive | 1 | 0]" 21//usage: "[Enforcing | Permissive | 1 | 0]"
diff --git a/selinux/setfiles.c b/selinux/setfiles.c
index c9597d54e..4fc307f55 100644
--- a/selinux/setfiles.c
+++ b/selinux/setfiles.c
@@ -3,6 +3,37 @@
3 policycoreutils was released under GPL 2. 3 policycoreutils was released under GPL 2.
4 Port to BusyBox (c) 2007 by Yuichi Nakamura <ynakam@hitachisoft.jp> 4 Port to BusyBox (c) 2007 by Yuichi Nakamura <ynakam@hitachisoft.jp>
5*/ 5*/
6//config:config SETFILES
7//config: bool "setfiles"
8//config: default n
9//config: depends on SELINUX
10//config: help
11//config: Enable support to modify to relabel files.
12//config: Notice: If you built libselinux with -D_FILE_OFFSET_BITS=64,
13//config: (It is default in libselinux's Makefile), you _must_ enable
14//config: CONFIG_LFS.
15//config:
16//config:config FEATURE_SETFILES_CHECK_OPTION
17//config: bool "Enable check option"
18//config: default n
19//config: depends on SETFILES
20//config: help
21//config: Support "-c" option (check the validity of the contexts against
22//config: the specified binary policy) for setfiles. Requires libsepol.
23//config:
24//config:config RESTORECON
25//config: bool "restorecon"
26//config: default n
27//config: depends on SELINUX
28//config: help
29//config: Enable support to relabel files. The feature is almost
30//config: the same as setfiles, but usage is a little different.
31
32//applet:IF_SETFILES(APPLET(setfiles, BB_DIR_SBIN, BB_SUID_DROP))
33//applet:IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon))
34
35//kbuild:lib-$(CONFIG_SETFILES) += setfiles.o
36//kbuild:lib-$(CONFIG_RESTORECON) += setfiles.o
6 37
7//usage:#define setfiles_trivial_usage 38//usage:#define setfiles_trivial_usage
8//usage: "[-dnpqsvW] [-e DIR]... [-o FILE] [-r alt_root_path]" 39//usage: "[-dnpqsvW] [-e DIR]... [-o FILE] [-r alt_root_path]"
diff --git a/selinux/setsebool.c b/selinux/setsebool.c
index ec682e5c5..6a6bd031c 100644
--- a/selinux/setsebool.c
+++ b/selinux/setsebool.c
@@ -7,6 +7,17 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config SETSEBOOL
11//config: bool "setsebool"
12//config: default n
13//config: depends on SELINUX
14//config: help
15//config: Enable support for change boolean.
16//config: semanage and -P option is not supported yet.
17
18//applet:IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_SETSEBOOL) += setsebool.o
10 21
11//usage:#define setsebool_trivial_usage 22//usage:#define setsebool_trivial_usage
12//usage: "boolean value" 23//usage: "boolean value"