OSDN Git Service

initial commit
[openbsd-octeon/openbsd-octeon.git] / src / regress / sys / ffs / tests / rmdir / 11.t
1 #!/bin/sh
2 # $FreeBSD: src/tools/regression/fstest/tests/rmdir/11.t,v 1.1 2007/01/17 01:42:11 pjd Exp $
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 n0=`namegen`
7 n1=`namegen`
8 n2=`namegen`
9
10 expect 0 mkdir ${n2} 0755
11 cdir=`pwd`
12 cd ${n2}
13
14 expect 0 mkdir ${n0} 0755
15 expect 0 chown ${n0} 65534 65534
16 expect 0 chmod ${n0} 01777
17
18 # User owns both: the sticky directory and the directory to be removed.
19 expect 0 -u 65534 -g 65534 mkdir ${n0}/${n1} 0755
20 expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1}
21 # User owns the directory to be removed, but doesn't own the sticky directory.
22 expect 0 -u 65533 -g 65533 mkdir ${n0}/${n1} 0755
23 expect 0 -u 65533 -g 65533 rmdir ${n0}/${n1}
24 # User owns the sticky directory, but doesn't own the directory to be removed.
25 expect 0 -u 65533 -g 65533 mkdir ${n0}/${n1} 0755
26 expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1}
27 # User doesn't own the sticky directory nor the directory to be removed.
28 expect 0 -u 65534 -g 65534 mkdir ${n0}/${n1} 0755
29 expect "EACCES|EPERM" -u 65533 -g 65533 rmdir ${n0}/${n1}
30 expect 0 rmdir ${n0}/${n1}
31
32 expect 0 rmdir ${n0}
33
34 cd ${cdir}
35 expect 0 rmdir ${n2}