]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - tools/regression/pjdfstest/tests/chmod/12.t
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / tools / regression / pjdfstest / tests / chmod / 12.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 desc="verify SUID/SGID bit behaviour"
5
6 dir=`dirname $0`
7 . ${dir}/../misc.sh
8
9 echo "1..14"
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 # Check whether writing to the file by non-owner clears the SUID.
20 expect 0 create ${n0} 04777
21 expect 0777 -u 65534 -g 65534 open ${n0} O_WRONLY : write 0 x : fstat 0 mode
22 expect 0777 stat ${n0} mode
23 expect 0 unlink ${n0}
24
25 # Check whether writing to the file by non-owner clears the SGID.
26 expect 0 create ${n0} 02777
27 expect 0777 -u 65534 -g 65534 open ${n0} O_RDWR : write 0 x : fstat 0 mode
28 expect 0777 stat ${n0} mode
29 expect 0 unlink ${n0}
30
31 # Check whether writing to the file by non-owner clears the SUID+SGID.
32 expect 0 create ${n0} 06777
33 expect 0777 -u 65534 -g 65534 open ${n0} O_RDWR : write 0 x : fstat 0 mode
34 expect 0777 stat ${n0} mode
35 expect 0 unlink ${n0}
36
37 cd ${cdir}
38 expect 0 rmdir ${n2}