]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / acl / posix / posix_003_pos.ksh
1 #!/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 . $STF_SUITE/include/libtest.shlib
24
25 #
26 # DESCRIPTION:
27 #       Verify that ACLs survive remount.
28 #       Regression test for https://github.com/zfsonlinux/zfs/issues/4520
29 #
30 # STRATEGY:
31 #       1. Test presence of default and regular ACLs after remount
32 #          a. Can set and list ACL before remount
33 #          b. Can list ACL after remount
34 #
35
36 verify_runnable "both"
37 log_assert "Verify regular and default POSIX ACLs survive  remount"
38
39 typeset acl_str1="^group:$ZFS_ACL_STAFF_GROUP:-wx$"
40 typeset acl_str2="^default:group:$ZFS_ACL_STAFF_GROUP:-wx$"
41 typeset ACLDIR="$TESTDIR/dir.1"
42
43 log_note "Testing access to DIRECTORY"
44 log_must mkdir $ACLDIR
45 log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
46 log_must setfacl -d -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
47 getfacl $ACLDIR 2> /dev/null | egrep -q "$acl_str1"
48 if [ "$?" -eq "0" ]; then
49         getfacl $ACLDIR 2> /dev/null | egrep -q "$acl_str2"
50 fi
51
52 if [ "$?" -eq "0" ]; then
53         log_must zfs unmount $TESTPOOL/$TESTFS
54         log_must zfs mount $TESTPOOL/$TESTFS
55         log_must eval "getfacl $ACLDIR 2> /dev/null | egrep -q \"$acl_str1\""
56         log_must eval "getfacl $ACLDIR 2> /dev/null | egrep -q \"$acl_str2\""
57         log_pass "POSIX ACLs survive remount"
58 else
59         log_fail "Group '$ZFS_ACL_STAFF_GROUP' does not have 'rwx'"
60 fi