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.
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.
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]
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
28 # Copyright (c) 2012 by Delphix. All rights reserved.
29 # Copyright 2016 Nexenta Systems, Inc.
32 .
$STF_SUITE/tests
/functional
/acl
/acl_common.kshlib
35 # Verify aclinherit=passthrough-x will inherit the execute permission only if
36 # file creation mode requests it.
39 # 1. Use both super user and non-super user to run the test case.
40 # 2. Set aclinherit=passthrough-x
41 # 3. Create basedir and a set of files, one with 644 and one with 755 mode.
42 # 4. Verify that execute permission is inherited only if file creation mode
45 verify_runnable
"both"
49 [[ -d $basedir ]] && log_must
$RM -rf $basedir
52 log_assert
"aclinherit=passthrough-x should inherit the execute permission" \
53 "only if file creation mode requests it"
57 "owner@:rwxp:f:allow" \
58 "group@:rxp:f:allow" \
59 "everyone@:rxp:f:allow"
61 typeset basedir
="$TESTDIR/basedir"
62 typeset nfile1
="$basedir/nfile1" nfile2
="$basedir/nfile2"
64 function check_execute_bit
71 ace
=$
(get_ACE
$file $i)
72 if [[ "$ace" == *"execute"* ]]; then
81 function verify_inherit
85 log_must usr_exec
$MKDIR $basedir
87 # Modify owner@, group@ and everyone@ ACEs to include execute
88 # permission (see above), and make them file-inheritable
89 while ((i
< ${#aces[*]})); do
90 log_must usr_exec
$CHMOD A
$i=${aces[i]} $basedir
94 # Create file with 644 mode
95 log_must usr_exec
$TOUCH $nfile1
96 # Check that execute permission wasn't inherited
97 log_mustnot check_execute_bit
$nfile1
99 # Use cp(1) to copy over /usr/bin/true
100 log_must usr_exec
$CP $TRUE $nfile2
101 # Check that execute permission was inherited
102 log_must check_execute_bit
$nfile2
105 log_must
$ZFS set aclmode
=passthrough
$TESTPOOL/$TESTFS
106 log_must
$ZFS set aclinherit
=passthrough-x
$TESTPOOL/$TESTFS
108 for user
in root
$ZFS_ACL_STAFF1; do
109 log_must set_cur_usr
$user
114 log_pass
"aclinherit=passthrough-x should inherit the execute permission" \
115 "only if file creation mode requests it"