Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
cc415790
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看板
提交
cc415790
编写于
6月 24, 2022
作者:
F
fwx1081852
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OH3.1release关于CAP测试套进程问题解决上库
Signed-off-by:
N
fwx1081852
<
fangbibo1@huawei.com
>
上级
6e1faa9d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
84 deletion
+42
-84
security_lite/permission_posix/capability/src/ActsCapabilityTest.cpp
...te/permission_posix/capability/src/ActsCapabilityTest.cpp
+35
-77
security_lite/permission_posix/capability/src/ActsCapabilityTest.h
...lite/permission_posix/capability/src/ActsCapabilityTest.h
+7
-7
未找到文件。
security_lite/permission_posix/capability/src/ActsCapabilityTest.cpp
浏览文件 @
cc415790
...
@@ -55,8 +55,8 @@ static void CreateTxt()
...
@@ -55,8 +55,8 @@ static void CreateTxt()
static
int
CapsetOnlySETPCAP
(
int
num
)
static
int
CapsetOnlySETPCAP
(
int
num
)
{
{
struct
__user_cap_header_struct
capheader
;
struct
__user_cap_header_struct
capheader
;
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
0
,
sizeof
(
struct
__user_cap_header_struct
));
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
return
FALSE
;
return
FALSE
;
...
@@ -85,8 +85,8 @@ static int CapsetOnlySETPCAP(int num)
...
@@ -85,8 +85,8 @@ static int CapsetOnlySETPCAP(int num)
static
int
AddCapUnauthorized
(
int
num
)
static
int
AddCapUnauthorized
(
int
num
)
{
{
struct
__user_cap_header_struct
capheader
;
struct
__user_cap_header_struct
capheader
;
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
0
,
sizeof
(
struct
__user_cap_header_struct
));
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
return
FALSE
;
return
FALSE
;
...
@@ -115,8 +115,8 @@ static int AddCapUnauthorized(int num)
...
@@ -115,8 +115,8 @@ static int AddCapUnauthorized(int num)
static
int
CapgetWithAllCap
(
int
num
)
static
int
CapgetWithAllCap
(
int
num
)
{
{
struct
__user_cap_header_struct
capheader
=
{
0
};
struct
__user_cap_header_struct
capheader
=
{
0
};
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
0
,
sizeof
(
struct
__user_cap_header_struct
));
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
return
FALSE
;
return
FALSE
;
...
@@ -148,8 +148,8 @@ static int CapgetWithAllCap(int num)
...
@@ -148,8 +148,8 @@ static int CapgetWithAllCap(int num)
static
int
CapgetWithNoCap
(
int
num
)
static
int
CapgetWithNoCap
(
int
num
)
{
{
struct
__user_cap_header_struct
capheader
=
{
0
};
struct
__user_cap_header_struct
capheader
=
{
0
};
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
0
,
sizeof
(
struct
__user_cap_header_struct
));
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
return
FALSE
;
return
FALSE
;
...
@@ -181,8 +181,8 @@ static int CapgetWithNoCap(int num)
...
@@ -181,8 +181,8 @@ static int CapgetWithNoCap(int num)
static
int
CapgetOnlySETPCAP
(
int
num
)
static
int
CapgetOnlySETPCAP
(
int
num
)
{
{
struct
__user_cap_header_struct
capheader
=
{
0
};
struct
__user_cap_header_struct
capheader
=
{
0
};
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
0
,
sizeof
(
struct
__user_cap_header_struct
));
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
return
FALSE
;
return
FALSE
;
...
@@ -258,8 +258,8 @@ static int CapsetWithoutSETPCAP()
...
@@ -258,8 +258,8 @@ static int CapsetWithoutSETPCAP()
static
int
CapsetWithVersion
(
pid_t
pid
,
unsigned
int
version
)
static
int
CapsetWithVersion
(
pid_t
pid
,
unsigned
int
version
)
{
{
struct
__user_cap_header_struct
capheader
=
{
0
};
struct
__user_cap_header_struct
capheader
=
{
0
};
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
0
,
sizeof
(
struct
__user_cap_header_struct
));
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
return
FALSE
;
return
FALSE
;
...
@@ -285,8 +285,8 @@ static int CapsetWithVersion(pid_t pid, unsigned int version)
...
@@ -285,8 +285,8 @@ static int CapsetWithVersion(pid_t pid, unsigned int version)
static
int
CapgetWithVersion
(
pid_t
pid
,
unsigned
int
version
)
static
int
CapgetWithVersion
(
pid_t
pid
,
unsigned
int
version
)
{
{
struct
__user_cap_header_struct
capheader
=
{
0
};
struct
__user_cap_header_struct
capheader
=
{
0
};
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
0
,
sizeof
(
struct
__user_cap_header_struct
));
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
return
FALSE
;
return
FALSE
;
...
@@ -308,14 +308,12 @@ static int CapgetWithVersion(pid_t pid, unsigned int version)
...
@@ -308,14 +308,12 @@ static int CapgetWithVersion(pid_t pid, unsigned int version)
}
}
return
0
;
return
0
;
}
}
#endif
#if defined(LITE_FS_VFAT)
static
int
CapgetWithCaps
(
pid_t
pid
,
unsigned
int
caps
)
static
int
CapgetWithCaps
(
pid_t
pid
,
unsigned
int
caps
)
{
{
struct
__user_cap_header_struct
capheader
=
{
0
};
struct
__user_cap_header_struct
capheader
=
{
0
};
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
0
,
sizeof
(
struct
__user_cap_header_struct
));
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
return
FALSE
;
return
FALSE
;
...
@@ -337,9 +335,7 @@ static int CapgetWithCaps(pid_t pid, unsigned int caps)
...
@@ -337,9 +335,7 @@ static int CapgetWithCaps(pid_t pid, unsigned int caps)
}
}
return
0
;
return
0
;
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_0600
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_0600
* @tc.name : Processes with the CAP_KILL capability can invoke their management
* @tc.name : Processes with the CAP_KILL capability can invoke their management
...
@@ -399,9 +395,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0600, Function | MediumTest | Level2
...
@@ -399,9 +395,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0600, Function | MediumTest | Level2
}
}
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_0700
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_0700
* @tc.name : Processes with the CAP_SETGID capability can invoke their management
* @tc.name : Processes with the CAP_SETGID capability can invoke their management
...
@@ -451,9 +445,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0700, Function | MediumTest | Level2
...
@@ -451,9 +445,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0700, Function | MediumTest | Level2
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_0800
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_0800
* @tc.name : Processes with the CAP_SETUID capability can invoke their management
* @tc.name : Processes with the CAP_SETUID capability can invoke their management
...
@@ -521,9 +513,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0800, Function | MediumTest | Level2
...
@@ -521,9 +513,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0800, Function | MediumTest | Level2
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_0900
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_0900
* @tc.name : Processes with the CAP_SETPCCAP capability can invoke their management
* @tc.name : Processes with the CAP_SETPCCAP capability can invoke their management
...
@@ -560,9 +550,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0900, Security | MediumTest | Level2
...
@@ -560,9 +550,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest0900, Security | MediumTest | Level2
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1000
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1000
* @tc.name : Processes with the CAP_SYS_NICE capability can invoke their management
* @tc.name : Processes with the CAP_SYS_NICE capability can invoke their management
...
@@ -626,9 +614,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1000, Function | MediumTest | Level2
...
@@ -626,9 +614,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1000, Function | MediumTest | Level2
}
}
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1100
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1100
* @tc.name : Processes with the CAP_SYS_TIME capability can call their management
* @tc.name : Processes with the CAP_SYS_TIME capability can call their management
...
@@ -677,9 +663,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1100, Function | MediumTest | Level2
...
@@ -677,9 +663,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1100, Function | MediumTest | Level2
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1200
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1200
* @tc.name : Processes without the CAP_SETPCAP capability cannot drop any capability
* @tc.name : Processes without the CAP_SETPCAP capability cannot drop any capability
...
@@ -705,9 +689,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1200, Function | MediumTest | Level3
...
@@ -705,9 +689,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1200, Function | MediumTest | Level3
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1300
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1300
* @tc.name : Inheritance of process capabilities
* @tc.name : Inheritance of process capabilities
...
@@ -742,9 +724,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1300, Function | MediumTest | Level1
...
@@ -742,9 +724,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1300, Function | MediumTest | Level1
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: CapgetWithAllCap error"
;
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: CapgetWithAllCap error"
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1400
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1400
* @tc.name : Invoke the capset interface to add and drop the process capabilities for 10000 times
* @tc.name : Invoke the capset interface to add and drop the process capabilities for 10000 times
...
@@ -781,9 +761,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1400, Reliability | MediumTest | Lev
...
@@ -781,9 +761,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1400, Reliability | MediumTest | Lev
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1500
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1500
* @tc.name : Invoke the capset interface to revoke the process capabilities which not exist for 10000 times
* @tc.name : Invoke the capset interface to revoke the process capabilities which not exist for 10000 times
...
@@ -799,8 +777,8 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1500, Reliability | MediumTest | Lev
...
@@ -799,8 +777,8 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1500, Reliability | MediumTest | Lev
if
(
pid
==
0
)
{
if
(
pid
==
0
)
{
int
exitCode
=
0
;
int
exitCode
=
0
;
struct
__user_cap_header_struct
capheader
=
{
0
};
struct
__user_cap_header_struct
capheader
=
{
0
};
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
0
,
sizeof
(
struct
__user_cap_header_struct
));
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
ASSERT_TRUE
(
false
);
ASSERT_TRUE
(
false
);
...
@@ -835,9 +813,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1500, Reliability | MediumTest | Lev
...
@@ -835,9 +813,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1500, Reliability | MediumTest | Lev
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1600
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1600
* @tc.name : Enter the exception parameter for 10000 times when invoke the capset interface
* @tc.name : Enter the exception parameter for 10000 times when invoke the capset interface
...
@@ -900,9 +876,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1600, Reliability | MediumTest | Lev
...
@@ -900,9 +876,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1600, Reliability | MediumTest | Lev
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1700
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1700
* @tc.name : Invoke the capget interface to query the process capabilities for 10000 times
* @tc.name : Invoke the capget interface to query the process capabilities for 10000 times
...
@@ -919,9 +893,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1700, Reliability | MediumTest | Lev
...
@@ -919,9 +893,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1700, Reliability | MediumTest | Lev
}
}
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1800
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1800
* @tc.name : Invoke the capget interface to query the process capabilities which not exist for 10000 times
* @tc.name : Invoke the capget interface to query the process capabilities which not exist for 10000 times
...
@@ -959,9 +931,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1800, Reliability | MediumTest | Lev
...
@@ -959,9 +931,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1800, Reliability | MediumTest | Lev
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: CapgetWithAllCap error"
;
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: CapgetWithAllCap error"
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1900
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_1900
* @tc.name : Enter the exception parameter for 10000 times when invoke the capget interface
* @tc.name : Enter the exception parameter for 10000 times when invoke the capget interface
...
@@ -1025,9 +995,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1900, Reliability | MediumTest | Lev
...
@@ -1025,9 +995,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest1900, Reliability | MediumTest | Lev
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2100
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2100
* @tc.name : Five processes concurrently invoke APIs managed by the capability for 5000 times
* @tc.name : Five processes concurrently invoke APIs managed by the capability for 5000 times
...
@@ -1081,9 +1049,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2100, Reliability | MediumTest | Lev
...
@@ -1081,9 +1049,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2100, Reliability | MediumTest | Lev
}
}
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2200
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2200
* @tc.name : Check whether the default configuration of the system process capabilities
* @tc.name : Check whether the default configuration of the system process capabilities
...
@@ -1099,31 +1065,29 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2200, Security | MediumTest | Level1
...
@@ -1099,31 +1065,29 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2200, Security | MediumTest | Level1
// Step 2: Check the capability of process 'KProcess', pid = 2
// Step 2: Check the capability of process 'KProcess', pid = 2
ret
=
CapgetWithCaps
(
KPROCESS_PID
,
KPROCESS_CAP
);
ret
=
CapgetWithCaps
(
KPROCESS_PID
,
KPROCESS_CAP
);
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid = 2, process KProcess has wrong capability"
;
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid = 2, process KProcess has wrong capability"
;
// Step 3: Check the capability of process 'shell', pid =
3
// Step 3: Check the capability of process 'shell', pid =
8
ret
=
CapgetWithCaps
(
SHELL_PID
,
SHELL_CAP
);
ret
=
CapgetWithCaps
(
SHELL_PID
,
SHELL_CAP
);
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
3
, process shell has wrong capability"
;
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
8
, process shell has wrong capability"
;
// Step 4: Check the capability of process 'apphilogcat', pid =
4
// Step 4: Check the capability of process 'apphilogcat', pid =
10
ret
=
CapgetWithCaps
(
HILOGCAT_PID
,
HILOGCAT_CAP
);
ret
=
CapgetWithCaps
(
HILOGCAT_PID
,
HILOGCAT_CAP
);
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
4
, process apphilogcat has wrong capability"
;
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
10
, process apphilogcat has wrong capability"
;
// Step 5: Check the capability of process 'foundation', pid =
5
// Step 5: Check the capability of process 'foundation', pid =
3
ret
=
CapgetWithCaps
(
FOUNDATION_PID
,
FOUNDATION_CAP
);
ret
=
CapgetWithCaps
(
FOUNDATION_PID
,
FOUNDATION_CAP
);
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
5
, process foundation has wrong capability"
;
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
3
, process foundation has wrong capability"
;
// Step 6: Check the capability of process 'bundle_daemon', pid =
6
// Step 6: Check the capability of process 'bundle_daemon', pid =
4
ret
=
CapgetWithCaps
(
BUNDLE_DAEMON_PID
,
BUNDLE_DAEMON_CAP
);
ret
=
CapgetWithCaps
(
BUNDLE_DAEMON_PID
,
BUNDLE_DAEMON_CAP
);
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
6
, process bundle_daemon has wrong capability"
;
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
4
, process bundle_daemon has wrong capability"
;
// Step 7: Check the capability of process 'appspawn', pid =
7
// Step 7: Check the capability of process 'appspawn', pid =
5
ret
=
CapgetWithCaps
(
APPSPAWN_PID
,
APPSPAWN_CAP
);
ret
=
CapgetWithCaps
(
APPSPAWN_PID
,
APPSPAWN_CAP
);
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
7
, process appspawn has wrong capability"
;
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
5
, process appspawn has wrong capability"
;
// Step 8: Check the capability of process 'media_server', pid =
8
// Step 8: Check the capability of process 'media_server', pid =
6
ret
=
CapgetWithCaps
(
MEDIA_SERVER_PID
,
MEDIA_SERVER_CAP
);
ret
=
CapgetWithCaps
(
MEDIA_SERVER_PID
,
MEDIA_SERVER_CAP
);
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
8
, process media_server has wrong capability"
;
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
6
, process media_server has wrong capability"
;
// Step 9: Check the capability of process 'wms_server' or 'ai_server', pid =
9
// Step 9: Check the capability of process 'wms_server' or 'ai_server', pid =
7
ret
=
CapgetWithCaps
(
WMS_SERVER_OR_AI_SERVER_PID
,
WMS_SERVER_OR_AI_SERVER_CAP
);
ret
=
CapgetWithCaps
(
WMS_SERVER_OR_AI_SERVER_PID
,
WMS_SERVER_OR_AI_SERVER_CAP
);
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
9
, process wms_server or ai_server has wrong capability"
;
EXPECT_EQ
(
ret
,
0
)
<<
"ErrInfo: Pid =
7
, process wms_server or ai_server has wrong capability"
;
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2300
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2300
* @tc.name : Check whether the default configuration of the capability of the third-party application process
* @tc.name : Check whether the default configuration of the capability of the third-party application process
...
@@ -1134,8 +1098,8 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2300, Security | MediumTest | Level1
...
@@ -1134,8 +1098,8 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2300, Security | MediumTest | Level1
{
{
int
ret
;
int
ret
;
struct
__user_cap_header_struct
capheader
=
{
0
};
struct
__user_cap_header_struct
capheader
=
{
0
};
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
errno_t
result
=
memset_s
(
&
capheader
,
sizeof
(
struct
__user_cap_header_struct
),
0
,
0
,
sizeof
(
struct
__user_cap_header_struct
));
sizeof
(
struct
__user_cap_header_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
ASSERT_TRUE
(
false
);
ASSERT_TRUE
(
false
);
...
@@ -1143,7 +1107,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2300, Security | MediumTest | Level1
...
@@ -1143,7 +1107,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2300, Security | MediumTest | Level1
capheader
.
version
=
_LINUX_CAPABILITY_VERSION_3
;
capheader
.
version
=
_LINUX_CAPABILITY_VERSION_3
;
struct
__user_cap_data_struct
capdataget
[
CAP_NUM
]
=
{
{
0
},
{
0
}
};
struct
__user_cap_data_struct
capdataget
[
CAP_NUM
]
=
{
{
0
},
{
0
}
};
result
=
memset_s
(
capdataget
,
CAP_NUM
*
sizeof
(
struct
__user_cap_data_struct
),
result
=
memset_s
(
capdataget
,
CAP_NUM
*
sizeof
(
struct
__user_cap_data_struct
),
0
,
CAP_NUM
*
sizeof
(
struct
__user_cap_data_struct
));
0
,
CAP_NUM
*
sizeof
(
struct
__user_cap_data_struct
));
if
(
result
!=
EOK
)
{
if
(
result
!=
EOK
)
{
LOG
(
"CapgetWithAllCap memset_s failed"
);
LOG
(
"CapgetWithAllCap memset_s failed"
);
ASSERT_TRUE
(
false
);
ASSERT_TRUE
(
false
);
...
@@ -1171,9 +1135,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2300, Security | MediumTest | Level1
...
@@ -1171,9 +1135,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2300, Security | MediumTest | Level1
}
}
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2400
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2400
* @tc.name : The process continuously invokes the capset and capget interfaces,
* @tc.name : The process continuously invokes the capset and capget interfaces,
...
@@ -1238,9 +1200,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2400, Function | MediumTest | Level1
...
@@ -1238,9 +1200,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2400, Function | MediumTest | Level1
}
}
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2500
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2500
* @tc.name : Performance test of capset and capget interface
* @tc.name : Performance test of capset and capget interface
...
@@ -1285,9 +1245,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2500, Performance | MediumTest | Lev
...
@@ -1285,9 +1245,7 @@ HWTEST_F(CapabilityTestSuite, CapabilityTest2500, Performance | MediumTest | Lev
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
EXPECT_EQ
(
WEXITSTATUS
(
status
),
0
)
<<
"ErrInfo: The exitCode is wrong, please query logs, child_pid = "
<<
pid
;
}
}
}
}
#endif
#if defined(LITE_FS_VFAT)
/*
/*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2600
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_Capability_2600
* @tc.name : Performance test of the interface managed by Capability
* @tc.name : Performance test of the interface managed by Capability
...
...
security_lite/permission_posix/capability/src/ActsCapabilityTest.h
100755 → 100644
浏览文件 @
cc415790
...
@@ -37,13 +37,13 @@ constexpr int NUM10000 = 10000;
...
@@ -37,13 +37,13 @@ constexpr int NUM10000 = 10000;
constexpr
int
INIT_PID
=
1
;
constexpr
int
INIT_PID
=
1
;
constexpr
int
KPROCESS_PID
=
2
;
constexpr
int
KPROCESS_PID
=
2
;
constexpr
int
SHELL_PID
=
3
;
constexpr
int
SHELL_PID
=
8
;
constexpr
int
HILOGCAT_PID
=
4
;
constexpr
int
HILOGCAT_PID
=
10
;
constexpr
int
FOUNDATION_PID
=
5
;
constexpr
int
FOUNDATION_PID
=
3
;
constexpr
int
BUNDLE_DAEMON_PID
=
6
;
constexpr
int
BUNDLE_DAEMON_PID
=
4
;
constexpr
int
APPSPAWN_PID
=
7
;
constexpr
int
APPSPAWN_PID
=
5
;
constexpr
int
MEDIA_SERVER_PID
=
8
;
constexpr
int
MEDIA_SERVER_PID
=
6
;
constexpr
int
WMS_SERVER_OR_AI_SERVER_PID
=
9
;
constexpr
int
WMS_SERVER_OR_AI_SERVER_PID
=
7
;
constexpr
int
HIVIEW_PID
=
10
;
constexpr
int
HIVIEW_PID
=
10
;
constexpr
int
OTHER_PID
=
12
;
constexpr
int
OTHER_PID
=
12
;
constexpr
int
INIT_PID_2
=
1
;
constexpr
int
INIT_PID_2
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录