changeset 1764:276664aa5ced

Promote setenforce to android.
author Rob Landley <rob@landley.net>
date Fri, 27 Mar 2015 22:03:13 -0500
parents 61166a30ae47
children 6699b1bbb791
files toys/android/setenforce.c toys/pending/setenforce.c
diffstat 2 files changed, 32 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toys/android/setenforce.c	Fri Mar 27 22:03:13 2015 -0500
@@ -0,0 +1,32 @@
+/* setenforce.c - Set the current SELinux mode
+ *
+ * Copyright 2014 The Android Open Source Project
+
+USE_SETENFORCE(NEWTOY(setenforce, "<1", TOYFLAG_USR|TOYFLAG_SBIN))
+
+config SETENFORCE
+  bool "setenforce"
+  default y
+  depends on TOYBOX_SELINUX
+  help
+    usage: setenforce [enforcing|permissive|1|0]
+
+    Sets whether SELinux is enforcing (1) or permissive (0).
+*/
+
+#define FOR_setenforce
+#include "toys.h"
+
+void setenforce_main(void)
+{
+  char *new = *toys.optargs;
+  int state, ret;
+
+  if (!is_selinux_enabled()) error_exit("SELinux is disabled");
+  else if (!strcmp(new, "1") || !strcasecmp(new, "enforcing")) state = 1;
+  else if (!strcmp(new, "0") || !strcasecmp(new, "permissive")) state = 0;
+  else error_exit("Invalid state: %s", new);
+
+  ret = security_setenforce(state);
+  if (ret == -1) perror_msg("Couldn't set enforcing status to '%s'", new);
+}
--- a/toys/pending/setenforce.c	Fri Mar 27 22:00:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/* setenforce.c - Set the current SELinux mode
- *
- * Copyright 2014 The Android Open Source Project
-
-USE_SETENFORCE(NEWTOY(setenforce, "<1", TOYFLAG_USR|TOYFLAG_SBIN))
-
-config SETENFORCE
-  bool "setenforce"
-  default n
-  depends on TOYBOX_SELINUX
-  help
-    usage: setenforce [enforcing|permissive|1|0]
-
-    Sets whether SELinux is enforcing (1) or permissive (0).
-*/
-
-#define FOR_setenforce
-#include "toys.h"
-
-void setenforce_main(void)
-{
-  char *new = *toys.optargs;
-  int state, ret;
-
-  if (!is_selinux_enabled()) error_exit("SELinux is disabled");
-  else if (!strcmp(new, "1") || !strcasecmp(new, "enforcing")) state = 1;
-  else if (!strcmp(new, "0") || !strcasecmp(new, "permissive")) state = 0;
-  else error_exit("Invalid state: %s", new);
-
-  ret = security_setenforce(state);
-  if (ret == -1) perror_msg("Couldn't set enforcing status to '%s'", new);
-}