From 3fd794f7416380417cc75d075a26559b80d3059a Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 27 Mar 2015 21:54:58 -0500 Subject: Promote getenforce. --- toys/android/getenforce.c | 29 +++++++++++++++++++++++++++++ toys/pending/getenforce.c | 29 ----------------------------- 2 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 toys/android/getenforce.c delete mode 100644 toys/pending/getenforce.c (limited to 'toys') diff --git a/toys/android/getenforce.c b/toys/android/getenforce.c new file mode 100644 index 00000000..465452e4 --- /dev/null +++ b/toys/android/getenforce.c @@ -0,0 +1,29 @@ +/* getenforce.c - Get the current SELinux mode + * + * Copyright 2014 The Android Open Source Project + +USE_GETENFORCE(NEWTOY(getenforce, "", TOYFLAG_USR|TOYFLAG_SBIN)) + +config GETENFORCE + bool "getenforce" + default y + depends on TOYBOX_SELINUX + help + usage: getenforce + + Shows whether SELinux is disabled, enforcing, or permissive. +*/ + +#define FOR_getenforce +#include "toys.h" + +void getenforce_main(void) +{ + if (!is_selinux_enabled()) puts("Disabled"); + else { + int ret = security_getenforce(); + + if (ret == -1) perror_exit("Couldn't get enforcing status"); + else puts(ret ? "Enforcing" : "Permissive"); + } +} diff --git a/toys/pending/getenforce.c b/toys/pending/getenforce.c deleted file mode 100644 index 71ae2032..00000000 --- a/toys/pending/getenforce.c +++ /dev/null @@ -1,29 +0,0 @@ -/* getenforce.c - Get the current SELinux mode - * - * Copyright 2014 The Android Open Source Project - -USE_GETENFORCE(NEWTOY(getenforce, "", TOYFLAG_USR|TOYFLAG_SBIN)) - -config GETENFORCE - bool "getenforce" - default n - depends on TOYBOX_SELINUX - help - usage: getenforce - - Shows whether SELinux is disabled, enforcing, or permissive. -*/ - -#define FOR_getenforce -#include "toys.h" - -void getenforce_main(void) -{ - if (!is_selinux_enabled()) puts("Disabled"); - else { - int ret = security_getenforce(); - - if (ret == -1) perror_exit("Couldn't get enforcing status"); - else puts(ret ? "Enforcing" : "Permissive"); - } -} -- cgit v1.2.3