xref: /freebsd/contrib/pjdfstest/tests/chown/05.t (revision 09a53ad8f1318c5daae6cfb19d97f4f6459f0013)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/05.t 211410 2010-08-17 06:08:09Z pjd $
3
4desc="chown returns EACCES when search permission is denied for a component of the path prefix"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..18"
10
11n0=`namegen`
12n1=`namegen`
13n2=`namegen`
14
15expect 0 mkdir ${n0} 0755
16cdir=`pwd`
17cd ${n0}
18expect 0 mkdir ${n1} 0755
19expect 0 chown ${n1} 65534 65534
20expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
21expect 0 -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65533
22expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid
23expect 0 chmod ${n1} 0644
24expect EACCES -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534
25expect EACCES -u 65534 -g 65533,65534 -- lchown ${n1}/${n2} -1 65534
26expect 0 chmod ${n1} 0755
27expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid
28expect 0 -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534
29expect 65534,65534 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid
30expect 0 -u 65534 -g 65533,65534 -- lchown ${n1}/${n2} -1 65533
31expect 65534,65533 -u 65534 -g 65533 stat ${n1}/${n2} uid,gid
32expect 0 unlink ${n1}/${n2}
33expect 0 rmdir ${n1}
34cd ${cdir}
35expect 0 rmdir ${n0}
36