From 3fa560ca6e0d68938f71ed1984f63f8c5cb7e7cc Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 7 Jan 2020 10:36:33 -0500 Subject: fsade: Support NFSv4 ACLs on FreeBSD --- tests.sh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'tests.sh') diff --git a/tests.sh b/tests.sh index 3b05bf6..900cf4e 100755 --- a/tests.sh +++ b/tests.sh @@ -2391,19 +2391,31 @@ function test_xtype_bind_mount() { return $ret } +function set_acl() { + uname="$(uname)" + + if [ "$uname" = "Darwin" ]; then + chmod +a "$(id -un) allow read,write" "$1" + elif [ "$uname" = "FreeBSD" ]; then + if [ "$(getconf ACL_EXTENDED "$1")" -gt 0 ]; then + setfacl -m "u:$(id -un):rw" "$1" + elif [ "$(getconf ACL_NFS4 "$1")" -gt 0 ]; then + setfacl -m "u:$(id -un):rw::allow" "$1" + else + return 1 + fi + else + return 1 + fi +} + function test_acl() { rm -rf scratch/* invoke_bfs scratch -quit -acl 2>/dev/null || return 0 touch scratch/{normal,acl} - - if [ "$(uname)" = "Darwin" ]; then - chmod +a "$(id -un) allow read,write" scratch/acl || return 0 - else - setfacl -m "u:$(id -un):rw" scratch/acl || return 0 - fi - + set_acl scratch/acl || return 0 ln -s acl scratch/link bfs_diff scratch -acl @@ -2415,13 +2427,7 @@ function test_L_acl() { invoke_bfs scratch -quit -acl 2>/dev/null || return 0 touch scratch/{normal,acl} - - if [ "$(uname)" = "Darwin" ]; then - chmod +a "$(id -un) allow read,write" scratch/acl || return 0 - else - setfacl -m "u:$(id -un):rw" scratch/acl || return 0 - fi - + set_acl scratch/acl || return 0 ln -s acl scratch/link bfs_diff -L scratch -acl -- cgit v1.2.3