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 https://opensource.org/licenses/CDDL-1.0.
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#
29# STRATEGY:
30#	1. Test presence of default and regular ACLs after remount
31#	   a. Can set and list ACL before remount
32#	   b. Can list ACL after remount
33#
34
35verify_runnable "both"
36log_assert "Verify regular and default POSIX ACLs survive  remount"
37
38typeset acl_str1="^group:$ZFS_ACL_STAFF_GROUP:-wx$"
39typeset acl_str2="^default:group:$ZFS_ACL_STAFF_GROUP:-wx$"
40typeset ACLDIR="$TESTDIR/dir.1"
41
42log_note "Testing access to DIRECTORY"
43log_must mkdir $ACLDIR
44log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
45log_must setfacl -d -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
46
47if getfacl $ACLDIR 2> /dev/null | grep -q "$acl_str1" &&
48	getfacl $ACLDIR 2> /dev/null | grep -q "$acl_str2"
49then
50	log_must zfs unmount $TESTPOOL/$TESTFS
51	log_must zfs mount $TESTPOOL/$TESTFS
52	log_must eval "getfacl $ACLDIR 2> /dev/null | grep -q \"$acl_str1\""
53	log_must eval "getfacl $ACLDIR 2> /dev/null | grep -q \"$acl_str2\""
54	log_pass "POSIX ACLs survive remount"
55else
56	log_fail "Group '$ZFS_ACL_STAFF_GROUP' does not have 'rwx'"
57fi
58