]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - tools/regression/fstest/tests/chflags/07.t
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / tools / regression / fstest / tests / chflags / 07.t
1 #!/bin/sh
2 # $FreeBSD$
3
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"
5
6 dir=`dirname $0`
7 . ${dir}/../misc.sh
8
9 require chflags
10
11 echo "1..30"
12
13 n0=`namegen`
14 n1=`namegen`
15 n2=`namegen`
16
17 expect 0 mkdir ${n0} 0755
18 cdir=`pwd`
19 cd ${n0}
20
21 expect 0 create ${n1} 0644
22 expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
23 expect none stat ${n1} flags
24 expect 0 chown ${n1} 65534 65534
25 expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
26 expect none stat ${n1} flags
27 expect 0 unlink ${n1}
28
29 expect 0 mkdir ${n1} 0755
30 expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
31 expect none stat ${n1} flags
32 expect 0 chown ${n1} 65534 65534
33 expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
34 expect none stat ${n1} flags
35 expect 0 rmdir ${n1}
36
37 expect 0 mkfifo ${n1} 0644
38 expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
39 expect none stat ${n1} flags
40 expect 0 chown ${n1} 65534 65534
41 expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
42 expect none stat ${n1} flags
43 expect 0 unlink ${n1}
44
45 expect 0 symlink ${n2} ${n1}
46 expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP
47 expect none lstat ${n1} flags
48 expect 0 lchown ${n1} 65534 65534
49 expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP
50 expect none lstat ${n1} flags
51 expect 0 unlink ${n1}
52
53 cd ${cdir}
54 expect 0 rmdir ${n0}