From 84b01f7d5b2955f43a806c48f8cefe62d0c50b2d Mon Sep 17 00:00:00 2001 From: chen Date: Mon, 14 Mar 2022 18:44:24 +0800 Subject: [PATCH] add token Signed-off-by: chen Change-Id: I8230557e5c3f87c642f9cc0610801ea091bb999b --- frameworks/native/source/system_ability_manager_proxy.cpp | 3 +++ .../samgr/native/source/system_ability_manager_stub.cpp | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frameworks/native/source/system_ability_manager_proxy.cpp b/frameworks/native/source/system_ability_manager_proxy.cpp index 78a8c4f1..f4e5fb03 100755 --- a/frameworks/native/source/system_ability_manager_proxy.cpp +++ b/frameworks/native/source/system_ability_manager_proxy.cpp @@ -102,6 +102,9 @@ sptr SystemAbilityManagerProxy::CheckSystemAbility(int32_t system return nullptr; } MessageParcel data; + if (!data.WriteInterfaceToken(SAMANAGER_INTERFACE_TOKEN)) { + return nullptr; + } bool ret = data.WriteInt32(systemAbilityId); if (!ret) { HILOGW("CheckSystemAbility Write systemAbilityId failed!"); diff --git a/services/samgr/native/source/system_ability_manager_stub.cpp b/services/samgr/native/source/system_ability_manager_stub.cpp index c86f9046..b42a79c1 100644 --- a/services/samgr/native/source/system_ability_manager_stub.cpp +++ b/services/samgr/native/source/system_ability_manager_stub.cpp @@ -59,11 +59,9 @@ int32_t SystemAbilityManagerStub::OnRemoteRequest(uint32_t code, { HILOGI("SystemAbilityManagerStub::OnReceived, code = %{public}u, flags= %{public}d", code, option.GetFlags()); - if (code != GET_SYSTEM_ABILITY_TRANSACTION && code != CHECK_SYSTEM_ABILITY_TRANSACTION) { - if (!EnforceInterceToken(data)) { - HILOGI("SystemAbilityManagerStub::OnReceived, code = %{public}u, check interfaceToken failed", code); - return ERR_PERMISSION_DENIED; - } + if (!EnforceInterceToken(data)) { + HILOGI("SystemAbilityManagerStub::OnReceived, code = %{public}u, check interfaceToken failed", code); + return ERR_PERMISSION_DENIED; } auto itFunc = memberFuncMap_.find(code); if (itFunc != memberFuncMap_.end()) { -- Gitee