4 if test "$VERBOSE" = yes; then
12 skip_if_mcstransd_is_running_
14 mkdir -p d/sub/s2 || framework_failure
15 touch f g d/sub/1 d/sub/2 || framework_failure
18 # Set to a specified context.
19 # Use root:object_r:tmp_t:s0. It is special in that
20 # it works even when mcstransd isn't running.
25 ctx=$u1:$r1:$t1:$range
26 chcon $ctx f || fail=1
27 stat --printf='f|%C\n' f > out || fail=1
30 chcon --ref=f g || fail=1
31 stat --printf='g|%C\n' g >> out || fail=1
33 # Change the individual parts of the context, one by one.
37 for i in --user=$u2 --role=$r2 --type=$t2 --range=$range; do
39 stat --printf="f|$i|"'%C\n' f >> out || fail=1
42 # Same, but change back using the short-named options.
43 for i in -u$u1 -r$r1 -t$t1; do
45 stat --printf="f|$i|"'%C\n' f >> out || fail=1
48 cat <<EOF > exp || fail=1
51 f|--user=$u2|$u2:$r1:$t1:$range
52 f|--role=$r2|$u2:$r2:$t1:$range
53 f|--type=$t2|$u2:$r2:$t2:$range
54 f|--range=$range|$u2:$r2:$t2:$range
55 f|-uroot|root:object_r:file_t:$range
56 f|-robject_r|root:object_r:file_t:$range
57 f|-ttmp_t|root:object_r:tmp_t:$range
60 compare out exp || fail=1
62 chcon --verbose -u$u1 f > out || fail=1
63 echo 'changing security context of `f'\' > exp
64 compare out exp || fail=1