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