summaryrefslogtreecommitdiff
path: root/cmds/servicemanager/ServiceManager.cpp
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2019-07-18 14:45:20 -0700
committer Steven Moreland <smoreland@google.com> 2019-07-18 14:45:20 -0700
commita9fe474392e0d45e06c4995df66e6bb6be6264fe (patch)
tree8246b9ed9253f81a1ea1b98aff69c7ad2d83e39f /cmds/servicemanager/ServiceManager.cpp
parent8f4c72d3dec2a2c66b4fb842e9e68f6cdf5e951e (diff)
CallingContext doesn't have a name in it.
This makes checking multiple things in the policy painful (which we may need to do in the future). Also, it makes the APIs around listing services somewhat bad. Bug: 135768100 Test: servicemanager_test Change-Id: I29cac39f6b63934740aa07a192e06b74ce8580ed
Diffstat (limited to 'cmds/servicemanager/ServiceManager.cpp')
-rw-r--r--cmds/servicemanager/ServiceManager.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp
index 6cfcf40970..c2c71e0770 100644
--- a/cmds/servicemanager/ServiceManager.cpp
+++ b/cmds/servicemanager/ServiceManager.cpp
@@ -32,7 +32,7 @@ Status ServiceManager::getService(const std::string& name, sp<IBinder>* outBinde
}
Status ServiceManager::checkService(const std::string& name, sp<IBinder>* outBinder) {
- auto ctx = mAccess->getCallingContext(name);
+ auto ctx = mAccess->getCallingContext();
auto it = mNameToService.find(name);
if (it == mNameToService.end()) {
@@ -53,7 +53,7 @@ Status ServiceManager::checkService(const std::string& name, sp<IBinder>* outBin
}
// TODO(b/136023468): move this check to be first
- if (!mAccess->canFind(ctx)) {
+ if (!mAccess->canFind(ctx, name)) {
// returns ok and null for legacy reasons
*outBinder = nullptr;
return Status::ok();
@@ -79,14 +79,14 @@ bool isValidServiceName(const std::string& name) {
}
Status ServiceManager::addService(const std::string& name, const sp<IBinder>& binder, bool allowIsolated, int32_t dumpPriority) {
- auto ctx = mAccess->getCallingContext(name);
+ auto ctx = mAccess->getCallingContext();
// apps cannot add services
if (multiuser_get_app_id(ctx.uid) >= AID_APP) {
return Status::fromExceptionCode(Status::EX_SECURITY);
}
- if (!mAccess->canAdd(ctx)) {
+ if (!mAccess->canAdd(ctx, name)) {
return Status::fromExceptionCode(Status::EX_SECURITY);
}
@@ -121,7 +121,7 @@ Status ServiceManager::addService(const std::string& name, const sp<IBinder>& bi
}
Status ServiceManager::listServices(int32_t dumpPriority, std::vector<std::string>* outList) {
- if (!mAccess->canList(mAccess->getCallingContext(""))) {
+ if (!mAccess->canList(mAccess->getCallingContext())) {
return Status::fromExceptionCode(Status::EX_SECURITY);
}