# Ensure that cp -a and cp --preserve=context work properly.
# In particular, test on a writable NFS partition.
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007-2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
|| framework_failure
mkdir mnt || framework_failure
mkfs -t ext2 -F blob > /dev/null 2>&1 || framework_failure
-mount -oloop,context=system_u:object_r:removable_t blob mnt \
- || framework_failure
+
+# This context is special: it works even when mcstransd isn't running.
+ctx=root:object_r:tmp_t:s0
+
+mount -oloop,context=$ctx blob mnt || framework_failure
cd mnt || framework_failure
echo > f || framework_failure
fail=0
# Set to a specified context.
+# Use root:object_r:tmp_t:s0. It is special in that
+# it works even when mcstransd isn't running.
u1=root
r1=object_r
t1=tmp_t
-ctx=$u1:$r1:$t1
+range=s0
+ctx=$u1:$r1:$t1:$range
chcon $ctx f || fail=1
stat --printf='f|%C\n' f > out || fail=1
u2=user_u
r2=object_r
t2=file_t
-l2=SystemLow-SystemHigh
-for i in --user=$u2 --role=$r2 --type=$t2 --range=$l2; do
+for i in --user=$u2 --role=$r2 --type=$t2 --range=$range; do
chcon $i f || fail=1
stat --printf="f|$i|"'%C\n' f >> out || fail=1
done
cat <<EOF > exp || fail=1
f|$ctx
g|$ctx
-f|--user=$u2|$u2:$r1:$t1
-f|--role=$r2|$u2:$r2:$t1
-f|--type=$t2|$u2:$r2:$t2
-f|--range=$l2|$u2:$r2:$t2:$l2
-f|-uroot|root:object_r:file_t:SystemLow-SystemHigh
-f|-robject_r|root:object_r:file_t:SystemLow-SystemHigh
-f|-ttmp_t|root:object_r:tmp_t:SystemLow-SystemHigh
+f|--user=$u2|$u2:$r1:$t1:$range
+f|--role=$r2|$u2:$r2:$t1:$range
+f|--type=$t2|$u2:$r2:$t2:$range
+f|--range=$range|$u2:$r2:$t2:$range
+f|-uroot|root:object_r:file_t:$range
+f|-robject_r|root:object_r:file_t:$range
+f|-ttmp_t|root:object_r:tmp_t:$range
EOF
compare out exp || fail=1