aboutsummaryrefslogtreecommitdiff
path: root/selinux
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-10-18 10:46:42 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-10-18 10:46:42 +0000
commit740eae0585202a5d8fd15847b4f771dff9f28c72 (patch)
treeddf6b209946139988114f2066f053ada6f041893 /selinux
parente87b8689d245083b355f32a751d05dfdf5176aba (diff)
downloadbusybox-740eae0585202a5d8fd15847b4f771dff9f28c72.tar.gz
busybox-740eae0585202a5d8fd15847b4f771dff9f28c72.tar.bz2
snv add setsebool
Diffstat (limited to 'selinux')
-rw-r--r--selinux/setsebool.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/selinux/setsebool.c b/selinux/setsebool.c
new file mode 100644
index 000000000..83e70e2d5
--- /dev/null
+++ b/selinux/setsebool.c
@@ -0,0 +1,34 @@
+/*
+ * setsebool
+ * Simple setsebool
+ * NOTE: -P option requires libsemanage, so this feature is
+ * omitted in this version
+ * Yuichi Nakamura <ynakam@hitachisoft.jp>
+ */
+
+#include "libbb.h"
+
+int setsebool_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+int setsebool_main(int argc, char **argv)
+{
+ char *p;
+ int value;
+
+ if (argc != 3)
+ bb_show_usage();
+
+ p = argv[2];
+
+ if (LONE_CHAR(p, '1') || strcasecmp(p, "true") == 0 || strcasecmp(p, "on") == 0) {
+ value = 1;
+ } else if (LONE_CHAR(p, '0') || strcasecmp(p, "false") == 0 || strcasecmp(p, "off") == 0) {
+ value = 0;
+ } else {
+ bb_show_usage();
+ }
+
+ if (security_set_boolean(argv[1], value) < 0)
+ bb_error_msg_and_die("can't set boolean");
+
+ return 0;
+}