summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nick Kralevich <nnk@google.com> 2016-12-09 17:05:09 -0800
committer Nick Kralevich <nnk@google.com> 2016-12-09 17:05:33 -0800
commiteb4d5cbde02b17259e968321ef457b158ce1da4e (patch)
tree60caf6d4f4af308b6226b1ff67b52025ec83a295
parent77f764d66fdfb89e0e7dd07fca64ae78fd02aad5 (diff)
service_manager.c: remove is_selinux_enabled calls
SELinux is always enabled. No need to check for it. Test: Device boots and service manager works without errors. Change-Id: I12be7336e7c31a5f5796ea1383f3dc934eb3c97c
-rw-r--r--cmds/servicemanager/service_manager.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/cmds/servicemanager/service_manager.c b/cmds/servicemanager/service_manager.c
index 68e3ceb8e6..ea4155848b 100644
--- a/cmds/servicemanager/service_manager.c
+++ b/cmds/servicemanager/service_manager.c
@@ -60,7 +60,6 @@ int str16eq(const uint16_t *a, const char *b)
return 1;
}
-static int selinux_enabled;
static char *service_manager_context;
static struct selabel_handle* sehandle;
@@ -89,10 +88,6 @@ static bool check_mac_perms(pid_t spid, uid_t uid, const char *tctx, const char
static bool check_mac_perms_from_getcon(pid_t spid, uid_t uid, const char *perm)
{
- if (selinux_enabled <= 0) {
- return true;
- }
-
return check_mac_perms(spid, uid, service_manager_context, perm, NULL);
}
@@ -101,10 +96,6 @@ static bool check_mac_perms_from_lookup(pid_t spid, uid_t uid, const char *perm,
bool allowed;
char *tctx = NULL;
- if (selinux_enabled <= 0) {
- return true;
- }
-
if (!sehandle) {
ALOGE("SELinux: Failed to find sehandle. Aborting service_manager.\n");
abort();
@@ -384,20 +375,17 @@ int main()
return -1;
}
- selinux_enabled = is_selinux_enabled();
sehandle = selinux_android_service_context_handle();
selinux_status_open(true);
- if (selinux_enabled > 0) {
- if (sehandle == NULL) {
- ALOGE("SELinux: Failed to acquire sehandle. Aborting.\n");
- abort();
- }
+ if (sehandle == NULL) {
+ ALOGE("SELinux: Failed to acquire sehandle. Aborting.\n");
+ abort();
+ }
- if (getcon(&service_manager_context) != 0) {
- ALOGE("SELinux: Failed to acquire service_manager context. Aborting.\n");
- abort();
- }
+ if (getcon(&service_manager_context) != 0) {
+ ALOGE("SELinux: Failed to acquire service_manager context. Aborting.\n");
+ abort();
}
union selinux_callback cb;