提交 9ab3e1f8 编写于 作者: X xionglei6

fix:增加selinux属性校验

Signed-off-by: Nxionglei6 <xionglei6@huawei.com>
上级 c0e607a0
......@@ -236,12 +236,9 @@ int TraversalParam(const ParamWorkSpace *workSpace,
}
#ifdef WITH_SELINUX
void *g_selinuxHandle = NULL;
int CheckParamPermissionWithSelinux(const ParamSecurityLabel *srcLabel, const char *name, uint32_t mode)
static void *g_selinuxHandle = NULL;
static int CheckParamPermissionWithSelinux(const ParamSecurityLabel *srcLabel, const char *name, uint32_t mode)
{
if (srcLabel == NULL || mode != DAC_WRITE) {
return DAC_RESULT_PERMISSION;
}
static void (*setSelinuxLogCallback)();
static int (*setParamCheck)(const char *paraName, struct ucred *uc);
g_selinuxHandle = dlopen("/system/lib/libparaperm_checker.z.so", RTLD_LAZY);
......@@ -287,9 +284,11 @@ int CheckParamPermission(const ParamWorkSpace *workSpace,
}
PARAM_CHECK(name != NULL && srcLabel != NULL, return -1, "Invalid param");
#ifdef WITH_SELINUX
int ret = CheckParamPermissionWithSelinux(srcLabel, name, mode);
if (ret == DAC_RESULT_PERMISSION) {
return DAC_RESULT_PERMISSION;
if (mode == DAC_WRITE) {
int ret = CheckParamPermissionWithSelinux(srcLabel, name, mode);
if (ret == DAC_RESULT_PERMISSION) {
return DAC_RESULT_PERMISSION;
}
}
#endif
if (workSpace->paramSecurityOps.securityCheckParamPermission == NULL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册