| #!/bin/sh |
| |
|
|
| |
|
|
| |
| |
| |
| |
|
|
| |
| |
| |
| |
|
|
| |
| |
|
|
| . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src |
| print_ver_ mkdir mknod mkfifo |
| require_selinux_ |
|
|
| mkdir subdir || framework_failure_ |
| ctx='root:object_r:tmp_t' |
| mls_enabled_ && ctx="$ctx:s0" |
| chcon "$ctx" subdir || skip_ "Failed to set context: $ctx" |
| cd subdir |
|
|
| |
| |
| mkdir standard || framework_failure_ |
| mkdir restored || framework_failure_ |
| if restorecon restored 2>/dev/null; then |
| |
| |
| |
| mkdir -Z single || fail=1 |
| |
| |
| |
| for dir in single_p single_p/existing multi/ple; do |
| mkdir -Zp "$dir" || fail=1 |
| done |
| restored_type=$(get_selinux_type 'restored') |
| test "$(get_selinux_type 'single')" = "$restored_type" || fail=1 |
| test "$(get_selinux_type 'single_p')" = "$restored_type" || fail=1 |
| test "$(get_selinux_type 'single_p/existing')" = "$restored_type" || fail=1 |
| test "$(get_selinux_type 'multi')" = "$restored_type" || fail=1 |
| test "$(get_selinux_type 'multi/ple')" = "$restored_type" || fail=1 |
| fi |
| if test "$fail" = '1'; then |
| ls -UZd standard restored |
| ls -UZd single single_p single_p/existing multi multi/ple |
| fi |
|
|
| |
| |
| for cmd_w_arg in 'mknod' 'mkfifo'; do |
| |
| |
| basename="$cmd_w_arg" |
| test "$basename" = 'mknod' && nt='p' || nt='' |
| env -- $cmd_w_arg $basename $nt || fail=1 |
| env -- $cmd_w_arg ${basename}_restore $nt || fail=1 |
| if restorecon ${basename}_restore 2>/dev/null; then |
| env -- $cmd_w_arg -Z ${basename}_Z $nt || fail=1 |
| restored_type=$(get_selinux_type "${basename}_restore") |
| test "$(get_selinux_type ${basename}_Z)" = "$restored_type" || fail=1 |
| fi |
| done |
|
|
| Exit $fail |
|
|