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