]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - tools/regression/fstest/tests/rmdir/11.t
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / tools / regression / fstest / tests / rmdir / 11.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 desc="rmdir returns EACCES or EPERM if the directory containing the directory to be removed is marked sticky, and neither the containing directory nor the directory to be removed are owned by the effective user ID"
5
6 dir=`dirname $0`
7 . ${dir}/../misc.sh
8
9 echo "1..15"
10
11 n0=`namegen`
12 n1=`namegen`
13 n2=`namegen`
14
15 expect 0 mkdir ${n2} 0755
16 cdir=`pwd`
17 cd ${n2}
18
19 expect 0 mkdir ${n0} 0755
20 expect 0 chown ${n0} 65534 65534
21 expect 0 chmod ${n0} 01777
22
23 # User owns both: the sticky directory and the directory to be removed.
24 expect 0 -u 65534 -g 65534 mkdir ${n0}/${n1} 0755
25 expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1}
26 # User owns the directory to be removed, but doesn't own the sticky directory.
27 expect 0 -u 65533 -g 65533 mkdir ${n0}/${n1} 0755
28 expect 0 -u 65533 -g 65533 rmdir ${n0}/${n1}
29 # User owns the sticky directory, but doesn't own the directory to be removed.
30 expect 0 -u 65533 -g 65533 mkdir ${n0}/${n1} 0755
31 expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1}
32 # User doesn't own the sticky directory nor the directory to be removed.
33 expect 0 -u 65534 -g 65534 mkdir ${n0}/${n1} 0755
34 expect "EACCES|EPERM" -u 65533 -g 65533 rmdir ${n0}/${n1}
35 expect 0 rmdir ${n0}/${n1}
36
37 expect 0 rmdir ${n0}
38
39 cd ${cdir}
40 expect 0 rmdir ${n2}