Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2deb86f0
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2deb86f0
编写于
2月 22, 2023
作者:
Q
qiaozzzh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed
a101711e
from
https://gitee.com/qiaozzzh/xts_acts/pulls/7703
Cap测试套优化 Signed-off-by:
N
qiaozzzh
<
qiaozhang@huawei.com
>
上级
35108924
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
48 deletion
+0
-48
security_lite/permission_posix/capability/src/ActsCapabilityTest.cpp
...te/permission_posix/capability/src/ActsCapabilityTest.cpp
+0
-48
未找到文件。
security_lite/permission_posix/capability/src/ActsCapabilityTest.cpp
浏览文件 @
2deb86f0
...
...
@@ -1085,54 +1085,6 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2200, Security | MediumTest | Level1
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid = 6, process media_server has wrong capability"
;
}
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2300
* @tc.name : Check whether the default configuration of the capability of the third-party application process
is the same as that described in the design document
* @tc.desc : [C-SECURITY-0100]
*/
HWTEST_F
(
CapabilityTestSuite
,
CapabilityTest2300
,
Security
|
MediumTest
|
Level1
)
{
int
ret
;
struct
__user_cap_header_struct
capheader
=
{
0
};
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
ASSERT_TRUE
(
false
);
};
capheader
.
version
=
_LINUX_CAPABILITY_VERSION_3
;
struct
__user_cap_data_struct
capdataget
[
CAP_NUM
]
=
{
{
0
},
{
0
}
};
result
=
memset_s
(
capdataget
,
CAP_NUM
*
sizeof
(
struct
__user_cap_data_struct
),
0
,
CAP_NUM
*
sizeof
(
struct
__user_cap_data_struct
));
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
ASSERT_TRUE
(
false
);
};
pid_t
pid
=
getpid
();
for
(
int
num
=
OTHER_PID
;
num
<=
pid
;
num
++
)
{
// Step 1: The current test process has all capabilities
if
(
num
==
pid
)
{
capheader
.
pid
=
pid
;
ret
=
capget
(
&
capheader
,
&
capdataget
[
0
]);
EXPECT_EQ
(
capdataget
[
0
].
effective
,
OHOS_FULL_CAP
)
<<
"ErrInfo: Pid = "
<<
num
<<
", test_process has wrong capability"
;
}
else
{
// Step 2: Check the capability of process from pid = 9
capheader
.
pid
=
num
;
ret
=
capget
(
&
capheader
,
&
capdataget
[
0
]);
if
(
ret
==
0
)
{
// Step 2.1: Check the capability of process which exists now
EXPECT_EQ
(
capdataget
[
0
].
effective
,
NO_CAP
)
<<
"ErrInfo: Pid = "
<<
num
<<
", thirdPartyApp has wrong capability"
;
}
else
{
// Step 2.2: Check the capability of process which not exist now
EXPECT_EQ
(
ret
,
FALSE
)
<<
"ErrInfo: Capget return error, now process uid="
<<
getuid
();
}
}
}
}
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2400
* @tc.name : The process continuously invokes the capset and capget interfaces,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录