From c787cf291ac8ef343dea81ca696b028c6974e0b2 Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Mon, 11 Jan 2016 13:04:19 -0800 Subject: [PATCH] Remove special case handling of "ro." properties permissions Currently, properties that begin with "ro." are special cased to skip over the "ro." part of the prefix before matching with entries in property_contexts. This is not strictly needed however and it is causing complications with the separated prop files work from Bug 21852512, so it is now removed. Bug 26425619 Change-Id: I3cd14fa2176f96b3931e5f6a50c4a7bcd3af3da6 --- init/property_service.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/init/property_service.cpp b/init/property_service.cpp index 806608ed5..5c1ae7912 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -113,18 +113,6 @@ static int check_control_mac_perms(const char *name, char *sctx, struct ucred *c return check_mac_perms(ctl_name, sctx, cr); } -/* - * Checks permissions for setting system properties. - * Returns 1 if uid allowed, 0 otherwise. - */ -static int check_perms(const char *name, char *sctx, struct ucred *cr) -{ - if(!strncmp(name, "ro.", 3)) - name +=3; - - return check_mac_perms(name, sctx, cr); -} - std::string property_get(const char* name) { char value[PROP_VALUE_MAX] = {0}; __system_property_get(name, value); @@ -312,7 +300,7 @@ static void handle_property_set_fd() msg.name + 4, msg.value, cr.uid, cr.gid, cr.pid); } } else { - if (check_perms(msg.name, source_ctx, &cr)) { + if (check_mac_perms(msg.name, source_ctx, &cr)) { property_set((char*) msg.name, (char*) msg.value); } else { ERROR("sys_prop: permission denied uid:%d name:%s\n",