From 5e0de644c894c33c9f577faff823f26f149198da Mon Sep 17 00:00:00 2001 From: chen Date: Sun, 13 Mar 2022 20:10:49 +0800 Subject: [PATCH] modify samgr uid Signed-off-by: chen Change-Id: I1c7462b5e3ae99bb8bea6af0b96cf315211fa75e --- .../source/system_ability_status_change_stub.cpp | 14 -------------- services/samgr/native/samgr_standard.cfg | 5 +++-- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/frameworks/native/source/system_ability_status_change_stub.cpp b/frameworks/native/source/system_ability_status_change_stub.cpp index bcae29e5..1b579ce0 100755 --- a/frameworks/native/source/system_ability_status_change_stub.cpp +++ b/frameworks/native/source/system_ability_status_change_stub.cpp @@ -20,10 +20,6 @@ #include "system_ability_definition.h" namespace OHOS { -namespace { -constexpr int32_t UID_ROOT = 0; -constexpr int32_t UID_SYSTEM = 1000; -} SystemAbilityStatusChangeStub::SystemAbilityStatusChangeStub() { memberFuncMap_[ON_ADD_SYSTEM_ABILITY] = @@ -36,10 +32,6 @@ int32_t SystemAbilityStatusChangeStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) { HILOGI("code:%{public}u, flags:%{public}d", code, option.GetFlags()); - if (!CanRequest()) { - HILOGW("permission denied!"); - return ERR_PERMISSION_DENIED; - } if (!EnforceInterceToken(data)) { HILOGW("check interface token failed!"); return ERR_PERMISSION_DENIED; @@ -84,12 +76,6 @@ bool SystemAbilityStatusChangeStub::CheckInputSysAbilityId(int32_t systemAbility return (systemAbilityId >= FIRST_SYS_ABILITY_ID) && (systemAbilityId <= LAST_SYS_ABILITY_ID); } -bool SystemAbilityStatusChangeStub::CanRequest() -{ - auto callingUid = IPCSkeleton::GetCallingUid(); - return (callingUid == UID_ROOT) || (callingUid == UID_SYSTEM); -} - bool SystemAbilityStatusChangeStub::EnforceInterceToken(MessageParcel& data) { std::u16string interfaceToken = data.ReadInterfaceToken(); diff --git a/services/samgr/native/samgr_standard.cfg b/services/samgr/native/samgr_standard.cfg index 0b75d904..67e36502 100755 --- a/services/samgr/native/samgr_standard.cfg +++ b/services/samgr/native/samgr_standard.cfg @@ -15,8 +15,9 @@ "name" : "samgr", "path" : ["/system/bin/samgr"], "critical" : [1, 1, 60], - "uid" : "system", - "gid" : ["system"], + "uid" : "samgr", + "gid" : ["samgr"], + "secon" : "u:r:samgr:s0", "start-mode" : "boot", "jobs" : { "on-start" : "services:samgr" -- Gitee