xref: /freebsd/contrib/pjdfstest/tests/granular/04.t (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/04.t 211352 2010-08-15 21:24:17Z pjd $
4
5desc="NFSv4 granular permissions checking - ACL_WRITE_OWNER"
6
7dir=`dirname $0`
8. ${dir}/../misc.sh
9
10nfsv4acls || quick_exit
11
12echo "1..22"
13
14n0=`namegen`
15n2=`namegen`
16
17expect 0 mkdir ${n2} 0755
18cdir=`pwd`
19cd ${n2}
20
21# ACL_WRITE_OWNER permits to set gid to our own only.
22expect 0 create ${n0} 0644
23expect 0,0 lstat ${n0} uid,gid
24expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65532
25expect 0,0 lstat ${n0} uid,gid
26expect 0 prependacl ${n0} user:65534:write_owner::allow
27expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65530
28expect 0,0 lstat ${n0} uid,gid
29expect 0 -u 65534 -g 65532,65531 chown ${n0} -1 65532
30expect 0,65532 lstat ${n0} uid,gid
31expect 0 unlink ${n0}
32
33# ACL_WRITE_OWNER permits to set uid to our own only.
34expect 0 create ${n0} 0644
35expect 0,0 lstat ${n0} uid,gid
36expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65534 65531
37expect 0,0 lstat ${n0} uid,gid
38expect 0 prependacl ${n0} user:65534:write_owner::allow
39expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65530 65531
40expect 0,0 lstat ${n0} uid,gid
41expect 0 -u 65534 -g 65532,65531 chown ${n0} 65534 65531
42expect 65534,65531 lstat ${n0} uid,gid
43expect 0 unlink ${n0}
44
45cd ${cdir}
46expect 0 rmdir ${n2}
47