提交 8cabde55 编写于 作者: M Mupceet

fix: selinux read check and cmd for param get

Signed-off-by: NMupceet <laiguizhong@huawei.com>
上级 88b01727
......@@ -126,10 +126,14 @@ static int CheckFilePermission(const ParamSecurityLabel *localLabel, const char
static int SelinuxReadParamCheck(const char *name)
{
PARAM_CHECK(g_selinuxSpace.getParamLabel != NULL, return NULL, "Invalid getParamLabel");
int ret = DAC_RESULT_FORBIDED;
PARAM_CHECK(g_selinuxSpace.getParamLabel != NULL, return ret, "Invalid getParamLabel");
const char *label = g_selinuxSpace.getParamLabel(name);
// open file with readonly
int ret = AddWorkSpace(label, 1, PARAM_WORKSPACE_MAX);
if (label == NULL) { // open file with readonly
ret = AddWorkSpace(WORKSPACE_NAME_DEF_SELINUX, 1, PARAM_WORKSPACE_MAX);
} else {
ret = AddWorkSpace(label, 1, PARAM_WORKSPACE_MAX);
}
if (ret != 0) {
return DAC_RESULT_FORBIDED;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册