Skip to content

Commit 832fccf

Browse files
stephensmalleyWOnder93
authored andcommitted
tests/capable_file: fix fsetid test
The current test for the SELinux fsetid capability check tries to set the setgid bit on a file with a different group ownership and compares the file mode before and after to determine success/failure. However, for reasons unknown, the current test runs chmod g+rs which tries to set both the read bit and setgid bit, and will change the read bit if not already set, causing the test to fail if the umask doesn't allow group read by default. Fix the test to only run chmod g+s. Signed-off-by: Stephen Smalley <[email protected]>
1 parent 8d0676a commit 832fccf

File tree

1 file changed

+2
-2
lines changed
  • tests/capable_file

1 file changed

+2
-2
lines changed

tests/capable_file/test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ok( $result eq 0 );
4040
# CAP_FSETID
4141
$fn = "$basedir/temp_file";
4242
$mode = ( stat($fn) )[2];
43-
system "runcon -t test_fcap_t -- chmod g+rs $basedir/temp_file 2>&1";
43+
system "runcon -t test_fcap_t -- chmod g+s $basedir/temp_file 2>&1";
4444
$result = 1;
4545
if ( $mode eq ( stat($fn) )[2] ) {
4646
$result = 0;
@@ -82,7 +82,7 @@ ok($result);
8282
$fn = "$basedir/temp_file";
8383
$mode = ( stat($fn) )[2];
8484
$result =
85-
system "runcon -t test_resfcap_t -- chmod g+rs $basedir/temp_file 2>&1";
85+
system "runcon -t test_resfcap_t -- chmod g+s $basedir/temp_file 2>&1";
8686
$result = 1;
8787
if ( $mode eq ( stat($fn) )[2] ) {
8888
$result = 0;

0 commit comments

Comments
 (0)