xref: /freebsd/contrib/pjdfstest/tests/link/06.t (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/link/06.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="link returns EACCES when a component of either path prefix denies search permission"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..18"
10
11n0=`namegen`
12n1=`namegen`
13n2=`namegen`
14n3=`namegen`
15n4=`namegen`
16
17expect 0 mkdir ${n0} 0755
18cdir=`pwd`
19cd ${n0}
20
21expect 0 mkdir ${n1} 0755
22expect 0 chown ${n1} 65534 65534
23expect 0 mkdir ${n2} 0755
24expect 0 chown ${n2} 65534 65534
25expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
26
27expect 0 -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4}
28expect 0 -u 65534 -g 65534 unlink ${n2}/${n4}
29
30expect 0 chmod ${n1} 0644
31expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n1}/${n4}
32expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4}
33
34expect 0 chmod ${n1} 0755
35expect 0 chmod ${n2} 0644
36expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4}
37
38expect 0 unlink ${n1}/${n3}
39expect 0 rmdir ${n1}
40expect 0 rmdir ${n2}
41
42cd ${cdir}
43expect 0 rmdir ${n0}
44