mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-21 03:12:48 +02:00
tests: support non-MLS enabled SELinux systems
When running "make check" on a Linux system running SELinux with a non-MLS policy, tests/mkdir/restorecon.sh test fails with: chcon: invalid context: root:object_r:tmp_t:s0: Invalid argument Indeed in such a configuration, contexts cannot have ":s0" suffix. * init.cfg (get_selinux_type): Refactor this function to here from various tests. Update to work with a non-MLS policy. (mls_enabled_): A new function to detect if MLS is enabled. (skip_if_mcstransd_is_running_): Update to not skip when MLS is not enabled. * tests/mkdir/restorecon.sh: Use a valid non-MLS context when needed. * tests/install/install-Z-selinux.sh: Likewise. * tests/cp/cp-a-selinux.sh: Likewise. * tests/misc/selinux.sh: Likewise. * tests/misc/chcon.sh: Skip if non-MLS as --range used throughout. Fixes http://bugs.gnu.org/22631
This commit is contained in:
committed by
Pádraig Brady
parent
ca52f3bf3f
commit
be2f82f670
@@ -20,11 +20,10 @@
|
||||
print_ver_ mkdir mknod mkfifo
|
||||
require_selinux_
|
||||
|
||||
|
||||
get_selinux_type() { ls -Zd "$1" | sed -n 's/.*:\(.*_t\):.*/\1/p'; }
|
||||
|
||||
mkdir subdir || framework_failure_
|
||||
chcon 'root:object_r:tmp_t:s0' subdir || framework_failure_
|
||||
ctx='root:object_r:tmp_t'
|
||||
mls_enabled_ && ctx="$ctx:s0"
|
||||
chcon "$ctx" subdir || framework_failure_
|
||||
cd subdir
|
||||
|
||||
# --- mkdir -Z ---
|
||||
|
||||
Reference in New Issue
Block a user