Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
b3c34b90
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
1 年多 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b3c34b90
编写于
7月 08, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
!919 修改param检查规格
Merge pull request !919 from Mupceet/initdac
上级
1b0d7f87
aff99754
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
20 addition
and
9 deletion
+20
-9
services/etc/param/ohos.para.dac
services/etc/param/ohos.para.dac
+2
-0
services/param/adapter/param_dac.c
services/param/adapter/param_dac.c
+7
-2
services/param/adapter/param_selinux.c
services/param/adapter/param_selinux.c
+4
-1
services/param/base/param_base.c
services/param/base/param_base.c
+2
-3
services/param/include/param_utils.h
services/param/include/param_utils.h
+1
-0
test/unittest/param/client_unittest.cpp
test/unittest/param/client_unittest.cpp
+2
-1
test/unittest/param/watcher_agent_unittest.cpp
test/unittest/param/watcher_agent_unittest.cpp
+2
-2
未找到文件。
services/etc/param/ohos.para.dac
浏览文件 @
b3c34b90
...
...
@@ -31,3 +31,5 @@ persist.window.boot. = root:system:0775
debug.bytrace. = root:system:0775
persist.distributed_hardware.device_manager. = system:system:0775
bootevent. = samgr:samgr:0777
hw_sc. = root:root:0777
services/param/adapter/param_dac.c
浏览文件 @
b3c34b90
...
...
@@ -237,8 +237,13 @@ static int DacCheckParamPermission(const ParamSecurityLabel *srcLabel, const cha
if
((
node
->
mode
&
localMode
)
!=
0
)
{
ret
=
DAC_RESULT_PERMISSION
;
}
PARAM_LOGV
(
"Param '%s' label gid:%d uid:%d mode 0%o"
,
name
,
srcLabel
->
cred
.
gid
,
srcLabel
->
cred
.
uid
,
localMode
);
PARAM_LOGV
(
"Cfg label %d gid:%d uid:%d mode 0%o result %d"
,
labelIndex
,
node
->
gid
,
node
->
uid
,
node
->
mode
,
ret
);
if
(
ret
!=
DAC_RESULT_PERMISSION
)
{
PARAM_LOGW
(
"Param '%s' label gid:%d uid:%d mode 0%o"
,
name
,
srcLabel
->
cred
.
gid
,
srcLabel
->
cred
.
uid
,
localMode
);
PARAM_LOGW
(
"Cfg label %d gid:%d uid:%d mode 0%o "
,
labelIndex
,
node
->
gid
,
node
->
uid
,
node
->
mode
);
#ifndef STARTUP_INIT_TEST
ret
=
DAC_RESULT_PERMISSION
;
#endif
}
return
ret
;
}
...
...
services/param/adapter/param_selinux.c
浏览文件 @
b3c34b90
...
...
@@ -193,7 +193,10 @@ static int SelinuxCheckParamPermission(const ParamSecurityLabel *srcLabel, const
#endif
}
if
(
ret
!=
0
)
{
PARAM_LOGI
(
"Selinux check name %s pid %d uid %d %d result %d"
,
name
,
uc
.
pid
,
uc
.
uid
,
uc
.
gid
,
ret
);
PARAM_LOGW
(
"Selinux check name %s pid %d uid %d %d result %d"
,
name
,
uc
.
pid
,
uc
.
uid
,
uc
.
gid
,
ret
);
ret
=
DAC_RESULT_FORBIDED
;
}
else
{
ret
=
DAC_RESULT_PERMISSION
;
}
return
ret
;
}
...
...
services/param/base/param_base.c
浏览文件 @
b3c34b90
...
...
@@ -299,12 +299,11 @@ INIT_INNER_API int CheckParamPermission(const ParamSecurityLabel *srcLabel, cons
continue
;
}
if
(
ops
->
securityCheckParamPermission
==
NULL
)
{
ret
=
DAC_RESULT_FORBIDED
;
continue
;
}
ret
=
ops
->
securityCheckParamPermission
(
srcLabel
,
name
,
mode
);
PARAM_LOGV
(
"CheckParamPermission %s %s ret %d"
,
ops
->
name
,
name
,
ret
);
if
(
ret
==
DAC_RESULT_PERMISSION
)
{
if
(
ret
==
DAC_RESULT_FORBIDED
)
{
PARAM_LOGW
(
"CheckParamPermission %s %s FORBID"
,
ops
->
name
,
name
);
break
;
}
}
...
...
services/param/include/param_utils.h
浏览文件 @
b3c34b90
...
...
@@ -101,6 +101,7 @@ typedef struct cmdLineInfo {
#define PARAM_LOGI(fmt, ...) STARTUP_LOGI(PARAN_DOMAIN, PARAN_LABEL, fmt, ##__VA_ARGS__)
#define PARAM_LOGE(fmt, ...) STARTUP_LOGE(PARAN_DOMAIN, PARAN_LABEL, fmt, ##__VA_ARGS__)
#define PARAM_LOGV(fmt, ...) STARTUP_LOGV(PARAN_DOMAIN, PARAN_LABEL, fmt, ##__VA_ARGS__)
#define PARAM_LOGW(fmt, ...) STARTUP_LOGW(PARAN_DOMAIN, PARAN_LABEL, fmt, ##__VA_ARGS__)
#define PARAM_CHECK(retCode, exper, ...) \
if
(
!
(
retCode
))
{
\
...
...
test/unittest/param/client_unittest.cpp
浏览文件 @
b3c34b90
...
...
@@ -135,8 +135,9 @@ static void TestPermission()
EXPECT_EQ
(
ret
,
testResult
);
#endif
u_int32_t
len
=
sizeof
(
tmp
);
SetTestPermissionResult
(
DAC_RESULT_FORBIDED
);
ret
=
SystemGetParameter
(
testName
,
tmp
,
&
len
);
EXPECT_EQ
(
ret
,
testResult
);
EXPECT_EQ
(
ret
,
DAC_RESULT_FORBIDED
);
RegisterSecurityOps
(
0
);
SetTestPermissionResult
(
0
);
// recover testpermission result
}
...
...
test/unittest/param/watcher_agent_unittest.cpp
浏览文件 @
b3c34b90
...
...
@@ -61,7 +61,7 @@ public:
ret
=
SystemWatchParameter
(
"test.permission.watcher.tes^^^^t1*"
,
TestParameterChange
,
nullptr
);
EXPECT_NE
(
ret
,
0
);
ret
=
SystemWatchParameter
(
"test.permission.read.test1*"
,
TestParameterChange
,
nullptr
);
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
ret
,
DAC_RESULT_FORBIDED
);
return
0
;
}
...
...
@@ -78,7 +78,7 @@ public:
ret
=
SystemWatchParameter
(
"test.permission.watcher.tes^^^^t1*"
,
nullptr
,
nullptr
);
EXPECT_NE
(
ret
,
0
);
ret
=
SystemWatchParameter
(
"test.permission.read.test1*"
,
nullptr
,
nullptr
);
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
ret
,
DAC_RESULT_FORBIDED
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录