00.t revision 210984
1196948Strasz#!/bin/sh 2196948Strasz# $FreeBSD: head/tools/regression/fstest/tests/granular/00.t 210984 2010-08-06 23:58:54Z pjd $ 3196948Strasz 4196948Straszdesc="NFSv4 granular permissions checking - WRITE_DATA vs APPEND_DATA on directories" 5196948Strasz 6196948Straszdir=`dirname $0` 7196948Strasz. ${dir}/../misc.sh 8196948Strasz 9210984Spjd[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit 10210984Spjd 11196948Straszecho "1..49" 12196948Strasz 13196948Straszn0=`namegen` 14196948Straszn1=`namegen` 15196948Straszn2=`namegen` 16196948Straszn3=`namegen` 17196948Strasz 18196948Straszexpect 0 mkdir ${n2} 0755 19196948Straszexpect 0 mkdir ${n3} 0777 20196948Straszcdir=`pwd` 21196948Straszcd ${n2} 22196948Strasz 23196948Strasz# Tests 2..7 - check out whether root user can do stuff. 24196948Strasz# Can create files? 25196948Straszexpect 0 create ${n0} 0644 26196948Strasz 27196948Strasz# Can create symlinks? 28196948Straszexpect 0 link ${n0} ${n1} 29196948Straszexpect 0 unlink ${n1} 30196948Straszexpect 0 unlink ${n0} 31196948Strasz 32196948Strasz# Can create directories? 33196948Straszexpect 0 mkdir ${n0} 0755 34196948Straszexpect 0 rmdir ${n0} 35196948Strasz 36196948Strasz# Check whether user 65534 is permitted to create and remove 37196948Strasz# files, but not subdirectories. 38196948Straszexpect 0 prependacl . user:65534:write_data::allow,user:65534:append_data::deny 39196948Strasz 40196948Strasz# Can create files? 41196948Straszexpect 0 -u 65534 -g 65534 create ${n0} 0644 42196948Strasz 43196948Strasz# Can create symlinks? 44196948Straszexpect 0 -u 65534 -g 65534 link ${n0} ${n1} 45196948Straszexpect 0 -u 65534 -g 65534 unlink ${n1} 46196948Straszexpect 0 -u 65534 -g 65534 unlink ${n0} 47196948Strasz 48196948Strasz# Can create directories? 49196948Straszexpect EACCES -u 65534 -g 65534 mkdir ${n0} 0755 50196948Straszexpect ENOENT -u 65534 -g 65534 rmdir ${n0} 51196948Straszexpect 0 mkdir ${n0} 0755 52196948Straszexpect 0 -u 65534 -g 65534 rmdir ${n0} 53196948Strasz 54196948Strasz# Can move files from other directory? 55196948Straszexpect 0 create ../${n3}/${n1} 0644 56196948Straszexpect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} 57196948Strasz 58196948Strasz# Can move files from other directory overwriting existing files? 59196948Straszexpect 0 create ../${n3}/${n1} 0644 60196948Straszexpect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} 61196948Strasz 62196948Straszexpect 0 -u 65534 -g 65534 unlink ${n0} 63196948Strasz 64196948Strasz# Can move directories from other directory? 65196948Straszexpect 0 mkdir ../${n3}/${n1} 0777 66196948Straszexpect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} 67196948Strasz 68196948Strasz# Can move directories from other directory overwriting existing directory? 69196948Straszexpect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} 70196948Straszexpect 0 -u 65534 -g 65534 rmdir ../${n3}/${n1} 71196948Strasz 72196948Strasz# Check whether user 65534 is permitted to create 73196948Strasz# subdirectories, but not files - and to remove neither of them. 74196948Straszexpect 0 prependacl . user:65534:write_data::deny,user:65534:append_data::allow 75196948Strasz 76196948Strasz# Can create files? 77196948Straszexpect EACCES -u 65534 -g 65534 create ${n0} 0644 78196948Strasz 79196948Strasz# Can create symlinks? 80196948Straszexpect 0 create ${n0} 0644 81196948Straszexpect EACCES -u 65534 -g 65534 link ${n0} ${n1} 82196948Straszexpect ENOENT -u 65534 -g 65534 unlink ${n1} 83196948Straszexpect EACCES -u 65534 -g 65534 unlink ${n0} 84196948Straszexpect 0 unlink ${n0} 85196948Strasz 86196948Strasz# Can create directories? 87196948Straszexpect 0 -u 65534 -g 65534 mkdir ${n0} 0755 88196948Straszexpect EACCES -u 65534 -g 65534 rmdir ${n0} 89196948Straszexpect 0 rmdir ${n0} 90196948Strasz 91196948Strasz# Can move files from other directory? 92196948Straszexpect 0 create ../${n3}/${n1} 0644 93196948Straszexpect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} 94196948Strasz 95196948Strasz# Can move files from other directory overwriting existing files? 96196948Straszexpect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} 97196948Straszexpect 0 -u 65534 -g 65534 unlink ../${n3}/${n1} 98196948Strasz 99196948Strasz# Can move directories from other directory? 100196948Straszexpect 0 mkdir ../${n3}/${n1} 0777 101196948Straszexpect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} 102196948Strasz 103196948Strasz# Can move directories from other directory overwriting existing directory? 104196948Straszexpect 0 mkdir ../${n3}/${n1} 0777 105196948Straszexpect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} 106196948Straszexpect 0 prependacl . user:65534:delete_child::allow 107196948Straszexpect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} 108196948Straszexpect 0 -u 65534 -g 65534 rmdir ${n0} 109196948Strasz 110196948Straszcd ${cdir} 111196948Straszexpect 0 rmdir ${n2} 112196948Straszexpect 0 rmdir ${n3} 113