未验证 提交 603117bc 编写于 作者: O openharmony_ci 提交者: Gitee

!272 适配musl库的参数检查

Merge pull request !272 from 熊磊/0126
......@@ -52,6 +52,9 @@ ohos_static_library("param_service") {
} else {
sources += [ "adapter/param_dac.c" ]
defines += [ "PARAM_SUPPORT_DAC" ]
if (use_musl) {
defines += [ "PARAM_SUPPORT_DAC_CHECK" ]
}
}
deps = [
......@@ -93,6 +96,9 @@ ohos_shared_library("param_client") {
} else {
sources += [ "adapter/param_dac.c" ]
defines += [ "PARAM_SUPPORT_DAC" ]
if (use_musl) {
defines += [ "PARAM_SUPPORT_DAC_CHECK" ]
}
}
deps = [
......
......@@ -217,6 +217,9 @@ static int CheckUserInGroup(gid_t groupId, uid_t uid)
static int CheckParamPermission(const ParamSecurityLabel *srcLabel, const ParamAuditData *auditData, uint32_t mode)
{
#ifndef PARAM_SUPPORT_DAC_CHECK
return DAC_RESULT_PERMISSION;
#else
int ret = DAC_RESULT_FORBIDED;
PARAM_CHECK(srcLabel != NULL && auditData != NULL && auditData->name != NULL, return ret, "Invalid param");
PARAM_CHECK((mode & (DAC_READ | DAC_WRITE | DAC_WATCH)) != 0, return ret, "Invalid mode %x", mode);
......@@ -243,6 +246,7 @@ static int CheckParamPermission(const ParamSecurityLabel *srcLabel, const ParamA
auditData->dacData.gid, auditData->dacData.uid, auditData->dacData.mode);
PARAM_LOGV("%s check %o localMode %o ret %d", auditData->name, mode, localMode, ret);
return ret;
#endif
}
PARAM_STATIC int RegisterSecurityDacOps(ParamSecurityOps *ops, int isInit)
......
......@@ -13,11 +13,7 @@
import("//build/ohos.gni")
ohos_prebuilt_etc("param_watcher.rc") {
if (use_musl) {
source = "etc/param_watcher.cfg"
} else {
source = "etc/param_watcher.rc"
}
source = "etc/param_watcher.cfg"
relative_install_dir = "init"
part_name = "init"
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册