aboutsummaryrefslogtreecommitdiff
path: root/selinux/setenforce.c
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-02-07 22:08:42 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-02-07 22:08:42 +0000
commit8c6c6e955b4a73b8a2cac8c0d277bc109b329908 (patch)
treead6dfaea9873084f50c69e53f69fca0f22b68b8e /selinux/setenforce.c
parent710694f0e5bae17ceba8c6f2694b856d6eab1c63 (diff)
downloadbusybox-8c6c6e955b4a73b8a2cac8c0d277bc109b329908.tar.gz
busybox-8c6c6e955b4a73b8a2cac8c0d277bc109b329908.tar.bz2
selinux fixes by KaiGai Kohei <kaigai@kaigai.gr.jp>
Diffstat (limited to 'selinux/setenforce.c')
-rw-r--r--selinux/setenforce.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/selinux/setenforce.c b/selinux/setenforce.c
index 670e30086..9204fcc39 100644
--- a/selinux/setenforce.c
+++ b/selinux/setenforce.c
@@ -8,12 +8,9 @@
#include "busybox.h"
-static const smallint setenforce_mode[] = {
- 0,
- 1,
- 0,
- 1,
-};
+/* These strings are arranged so that odd ones
+ * result in security_setenforce(1) being done,
+ * the rest will do security_setenforce(0) */
static const char *const setenforce_cmd[] = {
"0",
"1",
@@ -22,6 +19,7 @@ static const char *const setenforce_cmd[] = {
NULL,
};
+int setenforce_main(int argc, char **argv);
int setenforce_main(int argc, char **argv)
{
int i, rc;
@@ -34,7 +32,7 @@ int setenforce_main(int argc, char **argv)
for (i = 0; setenforce_cmd[i]; i++) {
if (strcasecmp(argv[1], setenforce_cmd[i]) != 0)
continue;
- rc = security_setenforce(setenforce_mode[i]);
+ rc = security_setenforce(i & 1);
if (rc < 0)
bb_perror_msg_and_die("setenforce() failed");
return 0;