提交 4665fb5e 编写于 作者: H hu-jixiang1

fix fail testcase

Change-Id: If1c64b4c03e54a6c4af01d0d7f7c314e52c8cffe
上级 844302b2
...@@ -31,12 +31,12 @@ static void CreateDevDir() ...@@ -31,12 +31,12 @@ static void CreateDevDir()
int ret; int ret;
// Initialize the process and set the uid and gid of the process to zero // Initialize the process and set the uid and gid of the process to zero
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Create a directory 'DACDIR0' in the directory '/dev' // Create a directory 'DACDIR0' in the directory '/storage'
ret = mkdir("/dev/" DACDIR0, CHMOD777); ret = mkdir("/storage/" DACDIR0, CHMOD777);
ASSERT_EQ(ret, 0) << "ErrInfo: Failed to create the directory '/dev/DACDIR0'"; ASSERT_EQ(ret, 0) << "ErrInfo: Failed to create the directory '/storage/DACDIR0'";
// Create a directory 'DACDIR0_DACDIR0' in the directory '/dev/DACDIR0' // Create a directory 'DACDIR0_DACDIR0' in the directory '/storage/DACDIR0'
ret = mkdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD777); ret = mkdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD777);
ASSERT_EQ(ret, 0) << "ErrInfo: Failed to create the directory '/dev/DACDIR0/DACDIR0_DACDIR0'"; ASSERT_EQ(ret, 0) << "ErrInfo: Failed to create the directory '/storage/DACDIR0/DACDIR0_DACDIR0'";
} }
static void CreateDevTxt() static void CreateDevTxt()
...@@ -45,20 +45,14 @@ static void CreateDevTxt() ...@@ -45,20 +45,14 @@ static void CreateDevTxt()
int fd = 0; int fd = 0;
// Initialize the process and set the uid and gid of the process to zero // Initialize the process and set the uid and gid of the process to zero
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Create a directory 'DACDIR0' in the directory '/dev' // Create a directory 'DACDIR0' in the directory '/storage'
ret = mkdir("/dev/" DACDIR0, CHMOD777); ret = mkdir("/storage/" DACDIR0, CHMOD777);
ASSERT_EQ(ret, 0) << "ErrInfo: Failed to create the directory '/dev/DACDIR0'"; ASSERT_EQ(ret, 0) << "ErrInfo: Failed to create the directory '/storage/DACDIR0'";
// Failed to create a file 'DACDIR0_DACFILE0' in the directory '/dev/DACDIR0'
fd = open("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, O_WRONLY | O_CREAT | O_TRUNC, CHMOD777);
if (fd >= 0) {
EXPECT_EQ(fd, FALSE) << "ErrInfo: Create a file 'DACDIR0_DACFILE0' in the directory '/dev/DACDIR0'";
close(fd);
}
} }
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0290 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0290
* @tc.name : DAC control mechanism-File system dev-System call rmdir-UID0-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call rmdir-UID0-GID1-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 333 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 333
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -68,7 +62,7 @@ HWTEST_F(DacTestSuite, DACTest0290, Function | MediumTest | Level2) ...@@ -68,7 +62,7 @@ HWTEST_F(DacTestSuite, DACTest0290, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD333); ret = chmod("/storage/" DACDIR0, CHMOD333);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 333"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 333";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -81,7 +75,7 @@ HWTEST_F(DacTestSuite, DACTest0290, Function | MediumTest | Level2) ...@@ -81,7 +75,7 @@ HWTEST_F(DacTestSuite, DACTest0290, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID555); SetUidGid(UID0, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = rmdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = rmdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -99,7 +93,7 @@ HWTEST_F(DacTestSuite, DACTest0290, Function | MediumTest | Level2) ...@@ -99,7 +93,7 @@ HWTEST_F(DacTestSuite, DACTest0290, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0300 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0300
* @tc.name : DAC control mechanism-File system dev-System call rmdir-UID1-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call rmdir-UID1-GID0-Capability
CAPDACOVERRIDE-Permission 611 CAPDACOVERRIDE-Permission 611
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -109,7 +103,7 @@ HWTEST_F(DacTestSuite, DACTest0300, Function | MediumTest | Level2) ...@@ -109,7 +103,7 @@ HWTEST_F(DacTestSuite, DACTest0300, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD611); ret = chmod("/storage/" DACDIR0, CHMOD611);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 611"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 611";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -122,7 +116,7 @@ HWTEST_F(DacTestSuite, DACTest0300, Function | MediumTest | Level2) ...@@ -122,7 +116,7 @@ HWTEST_F(DacTestSuite, DACTest0300, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID0); SetUidGid(UID555, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = rmdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = rmdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -140,7 +134,7 @@ HWTEST_F(DacTestSuite, DACTest0300, Function | MediumTest | Level2) ...@@ -140,7 +134,7 @@ HWTEST_F(DacTestSuite, DACTest0300, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0310 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0310
* @tc.name : DAC control mechanism-File system dev-System call rmdir-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call rmdir-UID1-GID1-Capability
CAPDACOVERRIDE-Permission 105 CAPDACOVERRIDE-Permission 105
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -150,7 +144,7 @@ HWTEST_F(DacTestSuite, DACTest0310, Function | MediumTest | Level2) ...@@ -150,7 +144,7 @@ HWTEST_F(DacTestSuite, DACTest0310, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD105); ret = chmod("/storage/" DACDIR0, CHMOD105);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 105"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 105";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -163,7 +157,7 @@ HWTEST_F(DacTestSuite, DACTest0310, Function | MediumTest | Level2) ...@@ -163,7 +157,7 @@ HWTEST_F(DacTestSuite, DACTest0310, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = rmdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = rmdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -181,7 +175,7 @@ HWTEST_F(DacTestSuite, DACTest0310, Function | MediumTest | Level2) ...@@ -181,7 +175,7 @@ HWTEST_F(DacTestSuite, DACTest0310, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0320 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0320
* @tc.name : DAC control mechanism-File system dev-System call rmdir-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call rmdir-UID1-GID1-Capability
CAPDACOVERRIDE-Permission 555 CAPDACOVERRIDE-Permission 555
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -191,7 +185,7 @@ HWTEST_F(DacTestSuite, DACTest0320, Function | MediumTest | Level2) ...@@ -191,7 +185,7 @@ HWTEST_F(DacTestSuite, DACTest0320, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD555); ret = chmod("/storage/" DACDIR0, CHMOD555);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 555"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 555";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -204,7 +198,7 @@ HWTEST_F(DacTestSuite, DACTest0320, Function | MediumTest | Level2) ...@@ -204,7 +198,7 @@ HWTEST_F(DacTestSuite, DACTest0320, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = rmdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = rmdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -222,7 +216,7 @@ HWTEST_F(DacTestSuite, DACTest0320, Function | MediumTest | Level2) ...@@ -222,7 +216,7 @@ HWTEST_F(DacTestSuite, DACTest0320, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0330 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0330
* @tc.name : DAC control mechanism-File system dev-System call rmdir-UID1-GID1-Groups contain-Capability * @tc.name : DAC control mechanism-File system storage-System call rmdir-UID1-GID1-Groups contain-Capability
CAPDACREADSEARCH-Permission 666 CAPDACREADSEARCH-Permission 666
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -233,7 +227,7 @@ HWTEST_F(DacTestSuite, DACTest0330, Function | MediumTest | Level2) ...@@ -233,7 +227,7 @@ HWTEST_F(DacTestSuite, DACTest0330, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD666); ret = chmod("/storage/" DACDIR0, CHMOD666);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 666"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 666";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -247,7 +241,7 @@ HWTEST_F(DacTestSuite, DACTest0330, Function | MediumTest | Level2) ...@@ -247,7 +241,7 @@ HWTEST_F(DacTestSuite, DACTest0330, Function | MediumTest | Level2)
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
setgroups(SINGLESIZE, list); setgroups(SINGLESIZE, list);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = rmdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = rmdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -265,7 +259,7 @@ HWTEST_F(DacTestSuite, DACTest0330, Function | MediumTest | Level2) ...@@ -265,7 +259,7 @@ HWTEST_F(DacTestSuite, DACTest0330, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0340 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0340
* @tc.name : DAC control mechanism-File system dev-System call stat-UID0-GID1-Capability NULL-Permission 777 * @tc.name : DAC control mechanism-File system storage-System call stat-UID0-GID1-Capability NULL-Permission 777
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
HWTEST_F(DacTestSuite, DACTest0340, Function | MediumTest | Level2) HWTEST_F(DacTestSuite, DACTest0340, Function | MediumTest | Level2)
...@@ -274,7 +268,7 @@ HWTEST_F(DacTestSuite, DACTest0340, Function | MediumTest | Level2) ...@@ -274,7 +268,7 @@ HWTEST_F(DacTestSuite, DACTest0340, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD777); ret = chmod("/storage/" DACDIR0, CHMOD777);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 777"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 777";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -287,7 +281,7 @@ HWTEST_F(DacTestSuite, DACTest0340, Function | MediumTest | Level2) ...@@ -287,7 +281,7 @@ HWTEST_F(DacTestSuite, DACTest0340, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID555); SetUidGid(UID0, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = rmdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = rmdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -305,7 +299,7 @@ HWTEST_F(DacTestSuite, DACTest0340, Function | MediumTest | Level2) ...@@ -305,7 +299,7 @@ HWTEST_F(DacTestSuite, DACTest0340, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0350 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0350
* @tc.name : DAC control mechanism-File system dev-System call stat-UID1-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call stat-UID1-GID0-Capability
CAPDACOVERRIDE-Permission 166 CAPDACOVERRIDE-Permission 166
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -316,7 +310,7 @@ HWTEST_F(DacTestSuite, DACTest0350, Function | MediumTest | Level2) ...@@ -316,7 +310,7 @@ HWTEST_F(DacTestSuite, DACTest0350, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD166); ret = chmod("/storage/" DACDIR0, CHMOD166);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 166"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 166";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -329,7 +323,7 @@ HWTEST_F(DacTestSuite, DACTest0350, Function | MediumTest | Level2) ...@@ -329,7 +323,7 @@ HWTEST_F(DacTestSuite, DACTest0350, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID0); SetUidGid(UID555, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = stat("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, &buf); ret = stat("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, &buf);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -347,7 +341,7 @@ HWTEST_F(DacTestSuite, DACTest0350, Function | MediumTest | Level2) ...@@ -347,7 +341,7 @@ HWTEST_F(DacTestSuite, DACTest0350, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0360 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0360
* @tc.name : DAC control mechanism-File system dev-System call stat-UID0-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call stat-UID0-GID0-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 111 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 111
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -358,7 +352,7 @@ HWTEST_F(DacTestSuite, DACTest0360, Function | MediumTest | Level2) ...@@ -358,7 +352,7 @@ HWTEST_F(DacTestSuite, DACTest0360, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD111); ret = chmod("/storage/" DACDIR0, CHMOD111);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 111"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 111";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -371,7 +365,7 @@ HWTEST_F(DacTestSuite, DACTest0360, Function | MediumTest | Level2) ...@@ -371,7 +365,7 @@ HWTEST_F(DacTestSuite, DACTest0360, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = stat("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, &buf); ret = stat("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, &buf);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -389,7 +383,7 @@ HWTEST_F(DacTestSuite, DACTest0360, Function | MediumTest | Level2) ...@@ -389,7 +383,7 @@ HWTEST_F(DacTestSuite, DACTest0360, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0370 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0370
* @tc.name : DAC control mechanism-File system dev-System call stat-UID0-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call stat-UID0-GID0-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 210 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 210
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -400,7 +394,7 @@ HWTEST_F(DacTestSuite, DACTest0370, Function | MediumTest | Level2) ...@@ -400,7 +394,7 @@ HWTEST_F(DacTestSuite, DACTest0370, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD210); ret = chmod("/storage/" DACDIR0, CHMOD210);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 210"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 210";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -413,7 +407,7 @@ HWTEST_F(DacTestSuite, DACTest0370, Function | MediumTest | Level2) ...@@ -413,7 +407,7 @@ HWTEST_F(DacTestSuite, DACTest0370, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = stat("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, &buf); ret = stat("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, &buf);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -431,7 +425,7 @@ HWTEST_F(DacTestSuite, DACTest0370, Function | MediumTest | Level2) ...@@ -431,7 +425,7 @@ HWTEST_F(DacTestSuite, DACTest0370, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0380 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0380
* @tc.name : DAC control mechanism-File system dev-System call stat-UID1-GID1-Groups contain-Capability * @tc.name : DAC control mechanism-File system storage-System call stat-UID1-GID1-Groups contain-Capability
CAPDACOVERRIDE-Permission 655 CAPDACOVERRIDE-Permission 655
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -443,7 +437,7 @@ HWTEST_F(DacTestSuite, DACTest0380, Function | MediumTest | Level2) ...@@ -443,7 +437,7 @@ HWTEST_F(DacTestSuite, DACTest0380, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD655); ret = chmod("/storage/" DACDIR0, CHMOD655);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 655"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 655";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -457,7 +451,7 @@ HWTEST_F(DacTestSuite, DACTest0380, Function | MediumTest | Level2) ...@@ -457,7 +451,7 @@ HWTEST_F(DacTestSuite, DACTest0380, Function | MediumTest | Level2)
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
setgroups(SINGLESIZE, list); setgroups(SINGLESIZE, list);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = stat("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, &buf); ret = stat("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, &buf);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -475,7 +469,7 @@ HWTEST_F(DacTestSuite, DACTest0380, Function | MediumTest | Level2) ...@@ -475,7 +469,7 @@ HWTEST_F(DacTestSuite, DACTest0380, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0390 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0390
* @tc.name : DAC control mechanism-File system dev-System call rename-UID1-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call rename-UID1-GID0-Capability
CAPDACREADSEARCH-Permission 570 CAPDACREADSEARCH-Permission 570
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -485,7 +479,7 @@ HWTEST_F(DacTestSuite, DACTest0390, Function | MediumTest | Level2) ...@@ -485,7 +479,7 @@ HWTEST_F(DacTestSuite, DACTest0390, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD570); ret = chmod("/storage/" DACDIR0, CHMOD570);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 570"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 570";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -498,7 +492,7 @@ HWTEST_F(DacTestSuite, DACTest0390, Function | MediumTest | Level2) ...@@ -498,7 +492,7 @@ HWTEST_F(DacTestSuite, DACTest0390, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID0); SetUidGid(UID555, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = rename("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, "/dev/" DACDIR0 "/" DACDIR0_DACDIR1); ret = rename("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, "/storage/" DACDIR0 "/" DACDIR0_DACDIR1);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -516,7 +510,7 @@ HWTEST_F(DacTestSuite, DACTest0390, Function | MediumTest | Level2) ...@@ -516,7 +510,7 @@ HWTEST_F(DacTestSuite, DACTest0390, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0400 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0400
* @tc.name : DAC control mechanism-File system dev-System call rename-UID1-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call rename-UID1-GID0-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 306 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 306
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -526,7 +520,7 @@ HWTEST_F(DacTestSuite, DACTest0400, Function | MediumTest | Level2) ...@@ -526,7 +520,7 @@ HWTEST_F(DacTestSuite, DACTest0400, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD306); ret = chmod("/storage/" DACDIR0, CHMOD306);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 306"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 306";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -539,7 +533,7 @@ HWTEST_F(DacTestSuite, DACTest0400, Function | MediumTest | Level2) ...@@ -539,7 +533,7 @@ HWTEST_F(DacTestSuite, DACTest0400, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID0); SetUidGid(UID555, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = rename("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, "/dev/" DACDIR0 "/" DACDIR0_DACDIR1); ret = rename("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, "/storage/" DACDIR0 "/" DACDIR0_DACDIR1);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -557,7 +551,7 @@ HWTEST_F(DacTestSuite, DACTest0400, Function | MediumTest | Level2) ...@@ -557,7 +551,7 @@ HWTEST_F(DacTestSuite, DACTest0400, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0410 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0410
* @tc.name : DAC control mechanism-File system dev-System call rename-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call rename-UID1-GID1-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 027 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 027
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -567,7 +561,7 @@ HWTEST_F(DacTestSuite, DACTest0410, Function | MediumTest | Level2) ...@@ -567,7 +561,7 @@ HWTEST_F(DacTestSuite, DACTest0410, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD027); ret = chmod("/storage/" DACDIR0, CHMOD027);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 027"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 027";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -580,7 +574,7 @@ HWTEST_F(DacTestSuite, DACTest0410, Function | MediumTest | Level2) ...@@ -580,7 +574,7 @@ HWTEST_F(DacTestSuite, DACTest0410, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = rename("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, "/dev/" DACDIR0 "/" DACDIR0_DACDIR1); ret = rename("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, "/storage/" DACDIR0 "/" DACDIR0_DACDIR1);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -598,7 +592,7 @@ HWTEST_F(DacTestSuite, DACTest0410, Function | MediumTest | Level2) ...@@ -598,7 +592,7 @@ HWTEST_F(DacTestSuite, DACTest0410, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0420 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0420
* @tc.name : DAC control mechanism-File system dev-System call chdir-UID0-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call chdir-UID0-GID1-Capability
CAPDACREADSEARCH-Permission 401 CAPDACREADSEARCH-Permission 401
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -608,7 +602,7 @@ HWTEST_F(DacTestSuite, DACTest0420, Function | MediumTest | Level2) ...@@ -608,7 +602,7 @@ HWTEST_F(DacTestSuite, DACTest0420, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD401); ret = chmod("/storage/" DACDIR0, CHMOD401);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 401"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 401";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -621,7 +615,7 @@ HWTEST_F(DacTestSuite, DACTest0420, Function | MediumTest | Level2) ...@@ -621,7 +615,7 @@ HWTEST_F(DacTestSuite, DACTest0420, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID555); SetUidGid(UID0, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = chdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = chdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -639,7 +633,7 @@ HWTEST_F(DacTestSuite, DACTest0420, Function | MediumTest | Level2) ...@@ -639,7 +633,7 @@ HWTEST_F(DacTestSuite, DACTest0420, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0430 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0430
* @tc.name : DAC control mechanism-File system dev-System call chdir-UID0-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call chdir-UID0-GID1-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 507 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 507
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -649,7 +643,7 @@ HWTEST_F(DacTestSuite, DACTest0430, Function | MediumTest | Level2) ...@@ -649,7 +643,7 @@ HWTEST_F(DacTestSuite, DACTest0430, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD507); ret = chmod("/storage/" DACDIR0, CHMOD507);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 507"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 507";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -662,7 +656,7 @@ HWTEST_F(DacTestSuite, DACTest0430, Function | MediumTest | Level2) ...@@ -662,7 +656,7 @@ HWTEST_F(DacTestSuite, DACTest0430, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID555); SetUidGid(UID0, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = chdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = chdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -680,7 +674,7 @@ HWTEST_F(DacTestSuite, DACTest0430, Function | MediumTest | Level2) ...@@ -680,7 +674,7 @@ HWTEST_F(DacTestSuite, DACTest0430, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0440 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0440
* @tc.name : DAC control mechanism-File system dev-System call chdir-UID0-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call chdir-UID0-GID0-Capability
CAPDACOVERRIDE-Permission 347 CAPDACOVERRIDE-Permission 347
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -690,7 +684,7 @@ HWTEST_F(DacTestSuite, DACTest0440, Function | MediumTest | Level2) ...@@ -690,7 +684,7 @@ HWTEST_F(DacTestSuite, DACTest0440, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD347); ret = chmod("/storage/" DACDIR0, CHMOD347);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 347"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 347";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -703,7 +697,7 @@ HWTEST_F(DacTestSuite, DACTest0440, Function | MediumTest | Level2) ...@@ -703,7 +697,7 @@ HWTEST_F(DacTestSuite, DACTest0440, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = chdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = chdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -721,7 +715,7 @@ HWTEST_F(DacTestSuite, DACTest0440, Function | MediumTest | Level2) ...@@ -721,7 +715,7 @@ HWTEST_F(DacTestSuite, DACTest0440, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0450 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0450
* @tc.name : DAC control mechanism-File system dev-System call chdir-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call chdir-UID1-GID1-Capability
CAPDACOVERRIDE-Permission 063 CAPDACOVERRIDE-Permission 063
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -731,7 +725,7 @@ HWTEST_F(DacTestSuite, DACTest0450, Function | MediumTest | Level2) ...@@ -731,7 +725,7 @@ HWTEST_F(DacTestSuite, DACTest0450, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD063); ret = chmod("/storage/" DACDIR0, CHMOD063);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 063"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 063";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -744,7 +738,7 @@ HWTEST_F(DacTestSuite, DACTest0450, Function | MediumTest | Level2) ...@@ -744,7 +738,7 @@ HWTEST_F(DacTestSuite, DACTest0450, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = chdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = chdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -762,7 +756,7 @@ HWTEST_F(DacTestSuite, DACTest0450, Function | MediumTest | Level2) ...@@ -762,7 +756,7 @@ HWTEST_F(DacTestSuite, DACTest0450, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0460 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0460
* @tc.name : DAC control mechanism-File system dev-System call chdir-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call chdir-UID1-GID1-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 230 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 230
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -772,7 +766,7 @@ HWTEST_F(DacTestSuite, DACTest0460, Function | MediumTest | Level2) ...@@ -772,7 +766,7 @@ HWTEST_F(DacTestSuite, DACTest0460, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD230); ret = chmod("/storage/" DACDIR0, CHMOD230);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 230"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 230";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -785,7 +779,7 @@ HWTEST_F(DacTestSuite, DACTest0460, Function | MediumTest | Level2) ...@@ -785,7 +779,7 @@ HWTEST_F(DacTestSuite, DACTest0460, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = chdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = chdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -803,7 +797,7 @@ HWTEST_F(DacTestSuite, DACTest0460, Function | MediumTest | Level2) ...@@ -803,7 +797,7 @@ HWTEST_F(DacTestSuite, DACTest0460, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0470 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0470
* @tc.name : DAC control mechanism-File system dev-System call chdir-UID1-GID1-Groups contain-Capability * @tc.name : DAC control mechanism-File system storage-System call chdir-UID1-GID1-Groups contain-Capability
CAPDACOVERRIDE-Permission 724 CAPDACOVERRIDE-Permission 724
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -814,7 +808,7 @@ HWTEST_F(DacTestSuite, DACTest0470, Function | MediumTest | Level2) ...@@ -814,7 +808,7 @@ HWTEST_F(DacTestSuite, DACTest0470, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD724); ret = chmod("/storage/" DACDIR0, CHMOD724);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 724"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 724";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -828,7 +822,7 @@ HWTEST_F(DacTestSuite, DACTest0470, Function | MediumTest | Level2) ...@@ -828,7 +822,7 @@ HWTEST_F(DacTestSuite, DACTest0470, Function | MediumTest | Level2)
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
setgroups(SINGLESIZE, list); setgroups(SINGLESIZE, list);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = chdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); ret = chdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -846,7 +840,7 @@ HWTEST_F(DacTestSuite, DACTest0470, Function | MediumTest | Level2) ...@@ -846,7 +840,7 @@ HWTEST_F(DacTestSuite, DACTest0470, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0480 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0480
* @tc.name : DAC control mechanism-File system dev-System call execute-UID1-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call execute-UID1-GID0-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 702 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 702
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -858,8 +852,8 @@ HWTEST_F(DacTestSuite, DACTest0480, Function | MediumTest | Level2) ...@@ -858,8 +852,8 @@ HWTEST_F(DacTestSuite, DACTest0480, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD702); ret = chmod("/storage/" DACDIR0, CHMOD702);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -872,7 +866,7 @@ HWTEST_F(DacTestSuite, DACTest0480, Function | MediumTest | Level2) ...@@ -872,7 +866,7 @@ HWTEST_F(DacTestSuite, DACTest0480, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID0); SetUidGid(UID555, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = execve("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, argv, envp); ret = execve("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, argv, envp);
// the file is not elf , can not exec // the file is not elf , can not exec
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
...@@ -891,7 +885,7 @@ HWTEST_F(DacTestSuite, DACTest0480, Function | MediumTest | Level2) ...@@ -891,7 +885,7 @@ HWTEST_F(DacTestSuite, DACTest0480, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0490 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0490
* @tc.name : DAC control mechanism-File system dev-System call execute-UID0-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call execute-UID0-GID0-Capability
CAPDACOVERRIDE-Permission 473 CAPDACOVERRIDE-Permission 473
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -903,8 +897,8 @@ HWTEST_F(DacTestSuite, DACTest0490, Function | MediumTest | Level2) ...@@ -903,8 +897,8 @@ HWTEST_F(DacTestSuite, DACTest0490, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD473); ret = chmod("/storage/" DACDIR0, CHMOD473);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -917,7 +911,7 @@ HWTEST_F(DacTestSuite, DACTest0490, Function | MediumTest | Level2) ...@@ -917,7 +911,7 @@ HWTEST_F(DacTestSuite, DACTest0490, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = execve("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, argv, envp); ret = execve("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, argv, envp);
// the file is not elf , can not exec // the file is not elf , can not exec
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
...@@ -936,7 +930,7 @@ HWTEST_F(DacTestSuite, DACTest0490, Function | MediumTest | Level2) ...@@ -936,7 +930,7 @@ HWTEST_F(DacTestSuite, DACTest0490, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0500 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0500
* @tc.name : DAC control mechanism-File system dev-System call execute-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call execute-UID1-GID1-Capability
CAPDACOVERRIDE-Permission 261 CAPDACOVERRIDE-Permission 261
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -948,8 +942,8 @@ HWTEST_F(DacTestSuite, DACTest0500, Function | MediumTest | Level2) ...@@ -948,8 +942,8 @@ HWTEST_F(DacTestSuite, DACTest0500, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD261); ret = chmod("/storage/" DACDIR0, CHMOD261);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -962,7 +956,7 @@ HWTEST_F(DacTestSuite, DACTest0500, Function | MediumTest | Level2) ...@@ -962,7 +956,7 @@ HWTEST_F(DacTestSuite, DACTest0500, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = execve("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, argv, envp); ret = execve("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, argv, envp);
// the file is not elf , can not exec // the file is not elf , can not exec
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
...@@ -981,7 +975,7 @@ HWTEST_F(DacTestSuite, DACTest0500, Function | MediumTest | Level2) ...@@ -981,7 +975,7 @@ HWTEST_F(DacTestSuite, DACTest0500, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0510 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0510
* @tc.name : DAC control mechanism-File system dev-System call access-UID0-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call access-UID0-GID1-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 460 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 460
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -991,8 +985,8 @@ HWTEST_F(DacTestSuite, DACTest0510, Function | MediumTest | Level2) ...@@ -991,8 +985,8 @@ HWTEST_F(DacTestSuite, DACTest0510, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD460); ret = chmod("/storage/" DACDIR0, CHMOD460);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1005,7 +999,7 @@ HWTEST_F(DacTestSuite, DACTest0510, Function | MediumTest | Level2) ...@@ -1005,7 +999,7 @@ HWTEST_F(DacTestSuite, DACTest0510, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID555); SetUidGid(UID0, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = access("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK); ret = access("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1023,7 +1017,7 @@ HWTEST_F(DacTestSuite, DACTest0510, Function | MediumTest | Level2) ...@@ -1023,7 +1017,7 @@ HWTEST_F(DacTestSuite, DACTest0510, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0520 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0520
* @tc.name : DAC control mechanism-File system dev-System call access-UID1-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call access-UID1-GID0-Capability
CAPDACOVERRIDE-Permission 562 CAPDACOVERRIDE-Permission 562
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1033,8 +1027,8 @@ HWTEST_F(DacTestSuite, DACTest0520, Function | MediumTest | Level2) ...@@ -1033,8 +1027,8 @@ HWTEST_F(DacTestSuite, DACTest0520, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD562); ret = chmod("/storage/" DACDIR0, CHMOD562);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1047,7 +1041,7 @@ HWTEST_F(DacTestSuite, DACTest0520, Function | MediumTest | Level2) ...@@ -1047,7 +1041,7 @@ HWTEST_F(DacTestSuite, DACTest0520, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID555); SetUidGid(UID0, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = access("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK); ret = access("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1066,7 +1060,7 @@ HWTEST_F(DacTestSuite, DACTest0520, Function | MediumTest | Level2) ...@@ -1066,7 +1060,7 @@ HWTEST_F(DacTestSuite, DACTest0520, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0530 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0530
* @tc.name : DAC control mechanism-File system dev-System call access-UID0-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call access-UID0-GID0-Capability
CAPDACOVERRIDE-Permission 076 CAPDACOVERRIDE-Permission 076
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1076,8 +1070,8 @@ HWTEST_F(DacTestSuite, DACTest0530, Function | MediumTest | Level2) ...@@ -1076,8 +1070,8 @@ HWTEST_F(DacTestSuite, DACTest0530, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD076); ret = chmod("/storage/" DACDIR0, CHMOD076);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1090,7 +1084,7 @@ HWTEST_F(DacTestSuite, DACTest0530, Function | MediumTest | Level2) ...@@ -1090,7 +1084,7 @@ HWTEST_F(DacTestSuite, DACTest0530, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = access("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK); ret = access("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1108,7 +1102,7 @@ HWTEST_F(DacTestSuite, DACTest0530, Function | MediumTest | Level2) ...@@ -1108,7 +1102,7 @@ HWTEST_F(DacTestSuite, DACTest0530, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0540 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0540
* @tc.name : DAC control mechanism-File system dev-System call access-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call access-UID1-GID1-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 305 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 305
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1119,8 +1113,8 @@ HWTEST_F(DacTestSuite, DACTest0540, Function | MediumTest | Level2) ...@@ -1119,8 +1113,8 @@ HWTEST_F(DacTestSuite, DACTest0540, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD076); ret = chmod("/storage/" DACDIR0, CHMOD076);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1134,7 +1128,7 @@ HWTEST_F(DacTestSuite, DACTest0540, Function | MediumTest | Level2) ...@@ -1134,7 +1128,7 @@ HWTEST_F(DacTestSuite, DACTest0540, Function | MediumTest | Level2)
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
setgroups(SINGLESIZE, list); setgroups(SINGLESIZE, list);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = access("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK); ret = access("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1152,7 +1146,7 @@ HWTEST_F(DacTestSuite, DACTest0540, Function | MediumTest | Level2) ...@@ -1152,7 +1146,7 @@ HWTEST_F(DacTestSuite, DACTest0540, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0550 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0550
* @tc.name : DAC control mechanism-File system dev-System call access-UID1-GID1-Groups contain-Capability * @tc.name : DAC control mechanism-File system storage-System call access-UID1-GID1-Groups contain-Capability
CAPDACOVERRIDE-Permission 132 CAPDACOVERRIDE-Permission 132
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1163,8 +1157,8 @@ HWTEST_F(DacTestSuite, DACTest0550, Function | MediumTest | Level2) ...@@ -1163,8 +1157,8 @@ HWTEST_F(DacTestSuite, DACTest0550, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD132); ret = chmod("/storage/" DACDIR0, CHMOD132);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1178,7 +1172,7 @@ HWTEST_F(DacTestSuite, DACTest0550, Function | MediumTest | Level2) ...@@ -1178,7 +1172,7 @@ HWTEST_F(DacTestSuite, DACTest0550, Function | MediumTest | Level2)
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
setgroups(SINGLESIZE, list); setgroups(SINGLESIZE, list);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = access("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK); ret = access("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1196,7 +1190,7 @@ HWTEST_F(DacTestSuite, DACTest0550, Function | MediumTest | Level2) ...@@ -1196,7 +1190,7 @@ HWTEST_F(DacTestSuite, DACTest0550, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0560 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0560
* @tc.name : DAC control mechanism-File system dev-System call access-UID1-GID1-Groups contain-Capability * @tc.name : DAC control mechanism-File system storage-System call access-UID1-GID1-Groups contain-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 241 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 241
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1207,8 +1201,8 @@ HWTEST_F(DacTestSuite, DACTest0560, Function | MediumTest | Level2) ...@@ -1207,8 +1201,8 @@ HWTEST_F(DacTestSuite, DACTest0560, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD241); ret = chmod("/storage/" DACDIR0, CHMOD241);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1222,7 +1216,7 @@ HWTEST_F(DacTestSuite, DACTest0560, Function | MediumTest | Level2) ...@@ -1222,7 +1216,7 @@ HWTEST_F(DacTestSuite, DACTest0560, Function | MediumTest | Level2)
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
setgroups(SINGLESIZE, list); setgroups(SINGLESIZE, list);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = access("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK); ret = access("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, F_OK);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1240,7 +1234,7 @@ HWTEST_F(DacTestSuite, DACTest0560, Function | MediumTest | Level2) ...@@ -1240,7 +1234,7 @@ HWTEST_F(DacTestSuite, DACTest0560, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0570 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0570
* @tc.name : DAC control mechanism-File system dev-System call mkdir-UID0-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call mkdir-UID0-GID1-Capability
CAPDACOVERRIDE-Permission 456 CAPDACOVERRIDE-Permission 456
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1250,7 +1244,7 @@ HWTEST_F(DacTestSuite, DACTest0570, Function | MediumTest | Level2) ...@@ -1250,7 +1244,7 @@ HWTEST_F(DacTestSuite, DACTest0570, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD456); ret = chmod("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD456);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 456"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 456";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1263,7 +1257,7 @@ HWTEST_F(DacTestSuite, DACTest0570, Function | MediumTest | Level2) ...@@ -1263,7 +1257,7 @@ HWTEST_F(DacTestSuite, DACTest0570, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID555); SetUidGid(UID0, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = mkdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0 "/" DACDIR0_DACDIR0_DACDIR0, NORWX); ret = mkdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0 "/" DACDIR0_DACDIR0_DACDIR0, NORWX);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1281,7 +1275,7 @@ HWTEST_F(DacTestSuite, DACTest0570, Function | MediumTest | Level2) ...@@ -1281,7 +1275,7 @@ HWTEST_F(DacTestSuite, DACTest0570, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0580 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0580
* @tc.name : DAC control mechanism-File system dev-System call mkdir-UID1-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call mkdir-UID1-GID0-Capability
CAPDACOVERRIDE-Permission 167 CAPDACOVERRIDE-Permission 167
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1291,7 +1285,7 @@ HWTEST_F(DacTestSuite, DACTest0580, Function | MediumTest | Level2) ...@@ -1291,7 +1285,7 @@ HWTEST_F(DacTestSuite, DACTest0580, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD167); ret = chmod("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD167);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 167"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 167";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1304,7 +1298,7 @@ HWTEST_F(DacTestSuite, DACTest0580, Function | MediumTest | Level2) ...@@ -1304,7 +1298,7 @@ HWTEST_F(DacTestSuite, DACTest0580, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID0); SetUidGid(UID555, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = mkdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0 "/" DACDIR0_DACDIR0_DACDIR0, NORWX); ret = mkdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0 "/" DACDIR0_DACDIR0_DACDIR0, NORWX);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1322,7 +1316,7 @@ HWTEST_F(DacTestSuite, DACTest0580, Function | MediumTest | Level2) ...@@ -1322,7 +1316,7 @@ HWTEST_F(DacTestSuite, DACTest0580, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0590 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0590
* @tc.name : DAC control mechanism-File system dev-System call mkdir-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call mkdir-UID1-GID1-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 511 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 511
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1332,7 +1326,7 @@ HWTEST_F(DacTestSuite, DACTest0590, Function | MediumTest | Level2) ...@@ -1332,7 +1326,7 @@ HWTEST_F(DacTestSuite, DACTest0590, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD511); ret = chmod("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD511);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 511"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 511";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1345,7 +1339,7 @@ HWTEST_F(DacTestSuite, DACTest0590, Function | MediumTest | Level2) ...@@ -1345,7 +1339,7 @@ HWTEST_F(DacTestSuite, DACTest0590, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = mkdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0 "/" DACDIR0_DACDIR0_DACDIR0, NORWX); ret = mkdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0 "/" DACDIR0_DACDIR0_DACDIR0, NORWX);
if (ret != 0) { if (ret != 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1363,7 +1357,7 @@ HWTEST_F(DacTestSuite, DACTest0590, Function | MediumTest | Level2) ...@@ -1363,7 +1357,7 @@ HWTEST_F(DacTestSuite, DACTest0590, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0600 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0600
* @tc.name : DAC control mechanism-File system dev-System call mkdir-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call mkdir-UID1-GID1-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 640 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 640
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1373,7 +1367,7 @@ HWTEST_F(DacTestSuite, DACTest0600, Function | MediumTest | Level2) ...@@ -1373,7 +1367,7 @@ HWTEST_F(DacTestSuite, DACTest0600, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD640); ret = chmod("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD640);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 640"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 640";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1386,7 +1380,7 @@ HWTEST_F(DacTestSuite, DACTest0600, Function | MediumTest | Level2) ...@@ -1386,7 +1380,7 @@ HWTEST_F(DacTestSuite, DACTest0600, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = mkdir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0 "/" DACDIR0_DACDIR0_DACDIR0, NORWX); ret = mkdir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0 "/" DACDIR0_DACDIR0_DACDIR0, NORWX);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1404,7 +1398,7 @@ HWTEST_F(DacTestSuite, DACTest0600, Function | MediumTest | Level2) ...@@ -1404,7 +1398,7 @@ HWTEST_F(DacTestSuite, DACTest0600, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0610 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0610
* @tc.name : DAC control mechanism-File system dev-System call unlink-UID0-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call unlink-UID0-GID1-Capability
CAPDACOVERRIDE-Permission 362 CAPDACOVERRIDE-Permission 362
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1414,8 +1408,8 @@ HWTEST_F(DacTestSuite, DACTest0610, Function | MediumTest | Level2) ...@@ -1414,8 +1408,8 @@ HWTEST_F(DacTestSuite, DACTest0610, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD362); ret = chmod("/storage/" DACDIR0, CHMOD362);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1428,7 +1422,7 @@ HWTEST_F(DacTestSuite, DACTest0610, Function | MediumTest | Level2) ...@@ -1428,7 +1422,7 @@ HWTEST_F(DacTestSuite, DACTest0610, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID555); SetUidGid(UID0, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = unlink("/dev/" DACDIR0 "/" DACDIR0_DACFILE0); ret = unlink("/storage/" DACDIR0 "/" DACDIR0_DACFILE0);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1446,7 +1440,7 @@ HWTEST_F(DacTestSuite, DACTest0610, Function | MediumTest | Level2) ...@@ -1446,7 +1440,7 @@ HWTEST_F(DacTestSuite, DACTest0610, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0620 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0620
* @tc.name : DAC control mechanism-File system dev-System call unlink-UID0-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call unlink-UID0-GID1-Capability
CAPDACOVERRIDE-Permission 526 CAPDACOVERRIDE-Permission 526
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1456,8 +1450,8 @@ HWTEST_F(DacTestSuite, DACTest0620, Function | MediumTest | Level2) ...@@ -1456,8 +1450,8 @@ HWTEST_F(DacTestSuite, DACTest0620, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD526); ret = chmod("/storage/" DACDIR0, CHMOD526);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1470,7 +1464,7 @@ HWTEST_F(DacTestSuite, DACTest0620, Function | MediumTest | Level2) ...@@ -1470,7 +1464,7 @@ HWTEST_F(DacTestSuite, DACTest0620, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID555); SetUidGid(UID0, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = unlink("/dev/" DACDIR0 "/" DACDIR0_DACFILE0); ret = unlink("/storage/" DACDIR0 "/" DACDIR0_DACFILE0);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1488,7 +1482,7 @@ HWTEST_F(DacTestSuite, DACTest0620, Function | MediumTest | Level2) ...@@ -1488,7 +1482,7 @@ HWTEST_F(DacTestSuite, DACTest0620, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0630 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0630
* @tc.name : DAC control mechanism-File system dev-System call unlink-UID0-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call unlink-UID0-GID0-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 604 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 604
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1498,8 +1492,8 @@ HWTEST_F(DacTestSuite, DACTest0630, Function | MediumTest | Level2) ...@@ -1498,8 +1492,8 @@ HWTEST_F(DacTestSuite, DACTest0630, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD604); ret = chmod("/storage/" DACDIR0, CHMOD604);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1512,7 +1506,7 @@ HWTEST_F(DacTestSuite, DACTest0630, Function | MediumTest | Level2) ...@@ -1512,7 +1506,7 @@ HWTEST_F(DacTestSuite, DACTest0630, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = unlink("/dev/" DACDIR0 "/" DACDIR0_DACFILE0); ret = unlink("/storage/" DACDIR0 "/" DACDIR0_DACFILE0);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1530,7 +1524,7 @@ HWTEST_F(DacTestSuite, DACTest0630, Function | MediumTest | Level2) ...@@ -1530,7 +1524,7 @@ HWTEST_F(DacTestSuite, DACTest0630, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0640 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0640
* @tc.name : DAC control mechanism-File system dev-System call unlink-UID0-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call unlink-UID0-GID0-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 671 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 671
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1540,8 +1534,8 @@ HWTEST_F(DacTestSuite, DACTest0640, Function | MediumTest | Level2) ...@@ -1540,8 +1534,8 @@ HWTEST_F(DacTestSuite, DACTest0640, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD671); ret = chmod("/storage/" DACDIR0, CHMOD671);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1554,7 +1548,7 @@ HWTEST_F(DacTestSuite, DACTest0640, Function | MediumTest | Level2) ...@@ -1554,7 +1548,7 @@ HWTEST_F(DacTestSuite, DACTest0640, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = unlink("/dev/" DACDIR0 "/" DACDIR0_DACFILE0); ret = unlink("/storage/" DACDIR0 "/" DACDIR0_DACFILE0);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1572,7 +1566,7 @@ HWTEST_F(DacTestSuite, DACTest0640, Function | MediumTest | Level2) ...@@ -1572,7 +1566,7 @@ HWTEST_F(DacTestSuite, DACTest0640, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0650 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0650
* @tc.name : DAC control mechanism-File system dev-System call unlink-UID0-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call unlink-UID0-GID0-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 743 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 743
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1582,8 +1576,8 @@ HWTEST_F(DacTestSuite, DACTest0650, Function | MediumTest | Level2) ...@@ -1582,8 +1576,8 @@ HWTEST_F(DacTestSuite, DACTest0650, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD743); ret = chmod("/storage/" DACDIR0, CHMOD743);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1596,7 +1590,7 @@ HWTEST_F(DacTestSuite, DACTest0650, Function | MediumTest | Level2) ...@@ -1596,7 +1590,7 @@ HWTEST_F(DacTestSuite, DACTest0650, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = unlink("/dev/" DACDIR0 "/" DACDIR0_DACFILE0); ret = unlink("/storage/" DACDIR0 "/" DACDIR0_DACFILE0);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1614,7 +1608,7 @@ HWTEST_F(DacTestSuite, DACTest0650, Function | MediumTest | Level2) ...@@ -1614,7 +1608,7 @@ HWTEST_F(DacTestSuite, DACTest0650, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0660 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0660
* @tc.name : DAC control mechanism-File system dev-System call unlink-UID1-GID1-Groups contain-Capability * @tc.name : DAC control mechanism-File system storage-System call unlink-UID1-GID1-Groups contain-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 235 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 235
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1625,8 +1619,8 @@ HWTEST_F(DacTestSuite, DACTest0660, Function | MediumTest | Level2) ...@@ -1625,8 +1619,8 @@ HWTEST_F(DacTestSuite, DACTest0660, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD235); ret = chmod("/storage/" DACDIR0, CHMOD235);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1640,7 +1634,7 @@ HWTEST_F(DacTestSuite, DACTest0660, Function | MediumTest | Level2) ...@@ -1640,7 +1634,7 @@ HWTEST_F(DacTestSuite, DACTest0660, Function | MediumTest | Level2)
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
setgroups(SINGLESIZE, list); setgroups(SINGLESIZE, list);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
ret = unlink("/dev/" DACDIR0 "/" DACDIR0_DACFILE0); ret = unlink("/storage/" DACDIR0 "/" DACDIR0_DACFILE0);
if (ret != FALSE) { if (ret != FALSE) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1658,7 +1652,7 @@ HWTEST_F(DacTestSuite, DACTest0660, Function | MediumTest | Level2) ...@@ -1658,7 +1652,7 @@ HWTEST_F(DacTestSuite, DACTest0660, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0670 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0670
* @tc.name : DAC control mechanism-File system dev-System call open-UID1-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call open-UID1-GID0-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 371 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 371
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1669,8 +1663,8 @@ HWTEST_F(DacTestSuite, DACTest0670, Function | MediumTest | Level2) ...@@ -1669,8 +1663,8 @@ HWTEST_F(DacTestSuite, DACTest0670, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD371); ret = chmod("/storage/" DACDIR0, CHMOD371);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1683,7 +1677,7 @@ HWTEST_F(DacTestSuite, DACTest0670, Function | MediumTest | Level2) ...@@ -1683,7 +1677,7 @@ HWTEST_F(DacTestSuite, DACTest0670, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID0); SetUidGid(UID555, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
fd = open("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, O_WRONLY); fd = open("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, O_WRONLY);
if (fd >= 0) { if (fd >= 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
close(fd); close(fd);
...@@ -1702,7 +1696,7 @@ HWTEST_F(DacTestSuite, DACTest0670, Function | MediumTest | Level2) ...@@ -1702,7 +1696,7 @@ HWTEST_F(DacTestSuite, DACTest0670, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0680 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0680
* @tc.name : DAC control mechanism-File system dev-System call open-UID1-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call open-UID1-GID0-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 702 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 702
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1713,8 +1707,8 @@ HWTEST_F(DacTestSuite, DACTest0680, Function | MediumTest | Level2) ...@@ -1713,8 +1707,8 @@ HWTEST_F(DacTestSuite, DACTest0680, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD702); ret = chmod("/storage/" DACDIR0, CHMOD702);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1727,7 +1721,7 @@ HWTEST_F(DacTestSuite, DACTest0680, Function | MediumTest | Level2) ...@@ -1727,7 +1721,7 @@ HWTEST_F(DacTestSuite, DACTest0680, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID0); SetUidGid(UID555, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
fd = open("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, O_WRONLY); fd = open("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, O_WRONLY);
if (fd >= 0) { if (fd >= 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
close(fd); close(fd);
...@@ -1746,7 +1740,7 @@ HWTEST_F(DacTestSuite, DACTest0680, Function | MediumTest | Level2) ...@@ -1746,7 +1740,7 @@ HWTEST_F(DacTestSuite, DACTest0680, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0690 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0690
* @tc.name : DAC control mechanism-File system dev-System call open-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call open-UID1-GID1-Capability
CAPDACOVERRIDE-Permission 406 CAPDACOVERRIDE-Permission 406
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1757,8 +1751,8 @@ HWTEST_F(DacTestSuite, DACTest0690, Function | MediumTest | Level2) ...@@ -1757,8 +1751,8 @@ HWTEST_F(DacTestSuite, DACTest0690, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD406); ret = chmod("/storage/" DACDIR0, CHMOD406);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1771,7 +1765,7 @@ HWTEST_F(DacTestSuite, DACTest0690, Function | MediumTest | Level2) ...@@ -1771,7 +1765,7 @@ HWTEST_F(DacTestSuite, DACTest0690, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
fd = open("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, O_WRONLY); fd = open("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, O_WRONLY);
if (fd >= 0) { if (fd >= 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
close(fd); close(fd);
...@@ -1790,7 +1784,7 @@ HWTEST_F(DacTestSuite, DACTest0690, Function | MediumTest | Level2) ...@@ -1790,7 +1784,7 @@ HWTEST_F(DacTestSuite, DACTest0690, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0700 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0700
* @tc.name : DAC control mechanism-File system dev-System call open-UID1-GID1-Groups contain-Capability * @tc.name : DAC control mechanism-File system storage-System call open-UID1-GID1-Groups contain-Capability
CAPDACOVERRIDE-Permission 257 CAPDACOVERRIDE-Permission 257
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1802,8 +1796,8 @@ HWTEST_F(DacTestSuite, DACTest0700, Function | MediumTest | Level2) ...@@ -1802,8 +1796,8 @@ HWTEST_F(DacTestSuite, DACTest0700, Function | MediumTest | Level2)
// Preset action: Create a file // Preset action: Create a file
CreateDevTxt(); CreateDevTxt();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0, CHMOD257); ret = chmod("/storage/" DACDIR0, CHMOD257);
// dev/shm can not change chmod // storage/shm can not change chmod
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod "; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod ";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1817,7 +1811,7 @@ HWTEST_F(DacTestSuite, DACTest0700, Function | MediumTest | Level2) ...@@ -1817,7 +1811,7 @@ HWTEST_F(DacTestSuite, DACTest0700, Function | MediumTest | Level2)
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
setgroups(SINGLESIZE, list); setgroups(SINGLESIZE, list);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
fd = open("/dev/" DACDIR0 "/" DACDIR0_DACFILE0, O_WRONLY); fd = open("/storage/" DACDIR0 "/" DACDIR0_DACFILE0, O_WRONLY);
if (fd >= 0) { if (fd >= 0) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
close(fd); close(fd);
...@@ -1836,7 +1830,7 @@ HWTEST_F(DacTestSuite, DACTest0700, Function | MediumTest | Level2) ...@@ -1836,7 +1830,7 @@ HWTEST_F(DacTestSuite, DACTest0700, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0710 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0710
* @tc.name : DAC control mechanism-File system dev-System call opendir-UID0-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call opendir-UID0-GID1-Capability
CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 750 CAPDACREADSEARCH_CAPDACOVERRIDE-Permission 750
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1847,7 +1841,7 @@ HWTEST_F(DacTestSuite, DACTest0710, Function | MediumTest | Level2) ...@@ -1847,7 +1841,7 @@ HWTEST_F(DacTestSuite, DACTest0710, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD750); ret = chmod("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD750);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 750"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 750";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1860,7 +1854,7 @@ HWTEST_F(DacTestSuite, DACTest0710, Function | MediumTest | Level2) ...@@ -1860,7 +1854,7 @@ HWTEST_F(DacTestSuite, DACTest0710, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID555); SetUidGid(UID0, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
dir = opendir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); dir = opendir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (dir == nullptr) { if (dir == nullptr) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1880,7 +1874,7 @@ HWTEST_F(DacTestSuite, DACTest0710, Function | MediumTest | Level2) ...@@ -1880,7 +1874,7 @@ HWTEST_F(DacTestSuite, DACTest0710, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0720 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0720
* @tc.name : DAC control mechanism-File system dev-System call opendir-UID0-GID0-Capability * @tc.name : DAC control mechanism-File system storage-System call opendir-UID0-GID0-Capability
CAPDACOVERRIDE-Permission 143 CAPDACOVERRIDE-Permission 143
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1891,7 +1885,7 @@ HWTEST_F(DacTestSuite, DACTest0720, Function | MediumTest | Level2) ...@@ -1891,7 +1885,7 @@ HWTEST_F(DacTestSuite, DACTest0720, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD143); ret = chmod("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD143);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 143"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 143";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1904,7 +1898,7 @@ HWTEST_F(DacTestSuite, DACTest0720, Function | MediumTest | Level2) ...@@ -1904,7 +1898,7 @@ HWTEST_F(DacTestSuite, DACTest0720, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
dir = opendir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); dir = opendir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (dir == nullptr) { if (dir == nullptr) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1924,7 +1918,7 @@ HWTEST_F(DacTestSuite, DACTest0720, Function | MediumTest | Level2) ...@@ -1924,7 +1918,7 @@ HWTEST_F(DacTestSuite, DACTest0720, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0730 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0730
* @tc.name : DAC control mechanism-File system dev-System call opendir-UID1-GID1-Capability * @tc.name : DAC control mechanism-File system storage-System call opendir-UID1-GID1-Capability
CAPDACOVERRIDE-Permission 521 CAPDACOVERRIDE-Permission 521
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1935,7 +1929,7 @@ HWTEST_F(DacTestSuite, DACTest0730, Function | MediumTest | Level2) ...@@ -1935,7 +1929,7 @@ HWTEST_F(DacTestSuite, DACTest0730, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD521); ret = chmod("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD521);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 521"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 521";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1948,7 +1942,7 @@ HWTEST_F(DacTestSuite, DACTest0730, Function | MediumTest | Level2) ...@@ -1948,7 +1942,7 @@ HWTEST_F(DacTestSuite, DACTest0730, Function | MediumTest | Level2)
// Step 2: Change the sub process uid, gid and groups according to the test procedure // Step 2: Change the sub process uid, gid and groups according to the test procedure
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
dir = opendir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); dir = opendir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (dir == nullptr) { if (dir == nullptr) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -1968,7 +1962,7 @@ HWTEST_F(DacTestSuite, DACTest0730, Function | MediumTest | Level2) ...@@ -1968,7 +1962,7 @@ HWTEST_F(DacTestSuite, DACTest0730, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0740 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0740
* @tc.name : DAC control mechanism-File system dev-System call opendir-UID1-GID1-Groups contain-Capability * @tc.name : DAC control mechanism-File system storage-System call opendir-UID1-GID1-Groups contain-Capability
CAPDACOVERRIDE-Permission 016 CAPDACOVERRIDE-Permission 016
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -1980,7 +1974,7 @@ HWTEST_F(DacTestSuite, DACTest0740, Function | MediumTest | Level2) ...@@ -1980,7 +1974,7 @@ HWTEST_F(DacTestSuite, DACTest0740, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD016); ret = chmod("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD016);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 016"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 016";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -1994,7 +1988,7 @@ HWTEST_F(DacTestSuite, DACTest0740, Function | MediumTest | Level2) ...@@ -1994,7 +1988,7 @@ HWTEST_F(DacTestSuite, DACTest0740, Function | MediumTest | Level2)
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
setgroups(SINGLESIZE, list); setgroups(SINGLESIZE, list);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
dir = opendir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); dir = opendir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (dir == nullptr) { if (dir == nullptr) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
...@@ -2014,7 +2008,7 @@ HWTEST_F(DacTestSuite, DACTest0740, Function | MediumTest | Level2) ...@@ -2014,7 +2008,7 @@ HWTEST_F(DacTestSuite, DACTest0740, Function | MediumTest | Level2)
/* /*
* @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0750 * @tc.number : SUB_SEC_AppSEC_PermissionMgmt_DAC_0750
* @tc.name : DAC control mechanism-File system dev-System call opendir-UID1-GID1-Groups contain-Capability * @tc.name : DAC control mechanism-File system storage-System call opendir-UID1-GID1-Groups contain-Capability
CAPDACOVERRIDE-Permission 407 CAPDACOVERRIDE-Permission 407
* @tc.desc : [C- SECURITY -0200] * @tc.desc : [C- SECURITY -0200]
*/ */
...@@ -2026,7 +2020,7 @@ HWTEST_F(DacTestSuite, DACTest0750, Function | MediumTest | Level2) ...@@ -2026,7 +2020,7 @@ HWTEST_F(DacTestSuite, DACTest0750, Function | MediumTest | Level2)
// Preset action: Create a directory // Preset action: Create a directory
CreateDevDir(); CreateDevDir();
// Preset action: Change the file permission according to the test procedure // Preset action: Change the file permission according to the test procedure
ret = chmod("/dev/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD407); ret = chmod("/storage/" DACDIR0 "/" DACDIR0_DACDIR0, CHMOD407);
EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 407"; EXPECT_EQ(ret, 0) << "ErrInfo: Failed to chmod 407";
// Preset action: Fork a sub process // Preset action: Fork a sub process
pid_t pid = fork(); pid_t pid = fork();
...@@ -2040,7 +2034,7 @@ HWTEST_F(DacTestSuite, DACTest0750, Function | MediumTest | Level2) ...@@ -2040,7 +2034,7 @@ HWTEST_F(DacTestSuite, DACTest0750, Function | MediumTest | Level2)
SetUidGid(UID555, GID555); SetUidGid(UID555, GID555);
setgroups(SINGLESIZE, list); setgroups(SINGLESIZE, list);
// Step 3: Invoke the interface to operate the file system // Step 3: Invoke the interface to operate the file system
dir = opendir("/dev/" DACDIR0 "/" DACDIR0_DACDIR0); dir = opendir("/storage/" DACDIR0 "/" DACDIR0_DACDIR0);
if (dir == nullptr) { if (dir == nullptr) {
LOG("ErrInfo: VFS error with DAC or Capability"); LOG("ErrInfo: VFS error with DAC or Capability");
exitCode = 1; exitCode = 1;
......
...@@ -31,7 +31,7 @@ void DacTestSuite::SetUp() ...@@ -31,7 +31,7 @@ void DacTestSuite::SetUp()
// Delete the the directory if exists // Delete the the directory if exists
RemoveDir(TOP_DIR "/" DACDIR0); RemoveDir(TOP_DIR "/" DACDIR0);
RemoveDir(TOP_DIR "/" DACDIR1); RemoveDir(TOP_DIR "/" DACDIR1);
RemoveDir("/dev/" DACDIR0); RemoveDir("/storage/" DACDIR0);
// Obtain the current working directory of the test code // Obtain the current working directory of the test code
mCurPath = GetCurrentPath(); mCurPath = GetCurrentPath();
// Modify the current working directory of the test code // Modify the current working directory of the test code
...@@ -47,7 +47,7 @@ void DacTestSuite::TearDown() ...@@ -47,7 +47,7 @@ void DacTestSuite::TearDown()
// Delete the the directory if exists // Delete the the directory if exists
RemoveDir(TOP_DIR "/" DACDIR0); RemoveDir(TOP_DIR "/" DACDIR0);
RemoveDir(TOP_DIR "/" DACDIR1); RemoveDir(TOP_DIR "/" DACDIR1);
RemoveDir("/dev/" DACDIR0); RemoveDir("/storage/" DACDIR0);
// Initialize the process and set the uid and gid of the process to zero // Initialize the process and set the uid and gid of the process to zero
SetUidGid(UID0, GID0); SetUidGid(UID0, GID0);
// Restore the working directory of the test code // Restore the working directory of the test code
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册