turns printfs back on
[freebsd-src/fkvm-freebsd.git] / tools / regression / fstest / tests / chflags / 07.t
blobef7c19cfe19c79812f0e3efac9842fa42219c597
1 #!/bin/sh
2 # $FreeBSD$
4 desc="chflags returns EPERM when the effective user ID does not match the owner of the file and the effective user ID is not the super-user"
6 dir=`dirname $0`
7 . ${dir}/../misc.sh
9 require chflags
11 echo "1..30"
13 n0=`namegen`
14 n1=`namegen`
15 n2=`namegen`
17 expect 0 mkdir ${n0} 0755
18 cdir=`pwd`
19 cd ${n0}
21 expect 0 create ${n1} 0644
22 expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
23 expect none stat ${n1} flags
24 expect 0 chown ${n1} 65534 65534
25 expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
26 expect none stat ${n1} flags
27 expect 0 unlink ${n1}
29 expect 0 mkdir ${n1} 0755
30 expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
31 expect none stat ${n1} flags
32 expect 0 chown ${n1} 65534 65534
33 expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
34 expect none stat ${n1} flags
35 expect 0 rmdir ${n1}
37 expect 0 mkfifo ${n1} 0644
38 expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
39 expect none stat ${n1} flags
40 expect 0 chown ${n1} 65534 65534
41 expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
42 expect none stat ${n1} flags
43 expect 0 unlink ${n1}
45 expect 0 symlink ${n2} ${n1}
46 expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE
47 expect none lstat ${n1} flags
48 expect 0 lchown ${n1} 65534 65534
49 expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE
50 expect none lstat ${n1} flags
51 expect 0 unlink ${n1}
53 cd ${cdir}
54 expect 0 rmdir ${n0}