diff options
author | Elliott Hughes <enh@google.com> | 2014-12-24 19:51:55 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-24 19:51:55 +0000 |
commit | b01c52aac2cc80a40e0b5e1c3b8f1a96eb064ecc (patch) | |
tree | b9567f23b9567bbd4d28f540654da574fcd4dc78 /toolbox | |
parent | 4138f9df99795a8b66ef9e0597f0671c837f7176 (diff) | |
parent | d106305f67b71653d4409a416c69796cbcc948e8 (diff) | |
download | system_core-b01c52aac2cc80a40e0b5e1c3b8f1a96eb064ecc.zip system_core-b01c52aac2cc80a40e0b5e1c3b8f1a96eb064ecc.tar.gz system_core-b01c52aac2cc80a40e0b5e1c3b8f1a96eb064ecc.tar.bz2 |
am d106305f: Merge "Lose getenforce and setenforce to toybox."
* commit 'd106305f67b71653d4409a416c69796cbcc948e8':
Lose getenforce and setenforce to toybox.
Diffstat (limited to 'toolbox')
-rw-r--r-- | toolbox/Android.mk | 2 | ||||
-rw-r--r-- | toolbox/getenforce.c | 30 | ||||
-rw-r--r-- | toolbox/setenforce.c | 44 |
3 files changed, 0 insertions, 76 deletions
diff --git a/toolbox/Android.mk b/toolbox/Android.mk index d20006f..aa4e70e 100644 --- a/toolbox/Android.mk +++ b/toolbox/Android.mk @@ -72,7 +72,6 @@ OUR_TOOLS := \ cmp \ date \ df \ - getenforce \ getevent \ getprop \ getsebool \ @@ -97,7 +96,6 @@ OUR_TOOLS := \ runcon \ schedtop \ sendevent \ - setenforce \ setprop \ setsebool \ smd \ diff --git a/toolbox/getenforce.c b/toolbox/getenforce.c deleted file mode 100644 index 9e7589a..0000000 --- a/toolbox/getenforce.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <unistd.h> -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <selinux/selinux.h> - -int getenforce_main(int argc, char **argv) -{ - int rc; - - rc = is_selinux_enabled(); - if (rc <= 0) { - printf("Disabled\n"); - return 0; - } - - rc = security_getenforce(); - if (rc < 0) { - fprintf(stderr, "Could not get enforcing status: %s\n", - strerror(errno)); - return 2; - } - - if (rc) - printf("Enforcing\n"); - else - printf("Permissive\n"); - - return 0; -} diff --git a/toolbox/setenforce.c b/toolbox/setenforce.c deleted file mode 100644 index 444073d..0000000 --- a/toolbox/setenforce.c +++ /dev/null @@ -1,44 +0,0 @@ -#include <unistd.h> -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> -#include <strings.h> -#include <errno.h> -#include <selinux/selinux.h> - -static void usage(const char *progname) -{ - fprintf(stderr, "usage: %s [ Enforcing | Permissive | 1 | 0 ]\n", - progname); - exit(1); -} - -int setenforce_main(int argc, char **argv) -{ - int rc = 0; - if (argc != 2) { - usage(argv[0]); - } - - if (is_selinux_enabled() <= 0) { - fprintf(stderr, "%s: SELinux is disabled\n", argv[0]); - return 1; - } - if (strlen(argv[1]) == 1 && (argv[1][0] == '0' || argv[1][0] == '1')) { - rc = security_setenforce(atoi(argv[1])); - } else { - if (strcasecmp(argv[1], "enforcing") == 0) { - rc = security_setenforce(1); - } else if (strcasecmp(argv[1], "permissive") == 0) { - rc = security_setenforce(0); - } else - usage(argv[0]); - } - if (rc < 0) { - fprintf(stderr, "%s: Could not set enforcing status: %s\n", - argv[0], strerror(errno)); - return 2; - } - return 0; -} |