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.
29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
30 # Copyright (c) 2013 by Paul B. Henson <henson@acm.org>. All rights reserved.
33 .
$STF_SUITE/tests
/functional
/acl
/acl.cfg
34 .
$STF_SUITE/tests
/functional
/acl
/acl_common.kshlib
38 # Verify chmod permission settings on files and directories, as both root
39 # and non-root users, with aclmode set to restricted.
42 # 1. Loop root and $ZFS_ACL_STAFF1 as root and non-root users.
43 # 2. Create test file and directory in zfs filesystem.
44 # 3. Execute 'chmod' with specified options.
45 # 4. Check 'ls -l' output and compare with expect results.
47 verify_runnable
"both"
51 # reset aclmode=discard
52 log_must zfs
set aclmode
=discard
$TESTPOOL/$TESTFS
55 # "init_map" "options" "expect_map"
57 "000" "a+rw" "rw-rw-rw-" "000" "a+rwx" "rwxrwxrwx" \
58 "000" "u+xr" "r-x------" "000" "gu-xw" "---------" \
59 "644" "a-r" "-w-------" "644" "augo-x" "rw-r--r--" \
60 "644" "=x" "--x--x--x" "644" "u-rw" "---r--r--" \
61 "644" "uo+x" "rwxr--r-x" "644" "ga-wr" "---------" \
62 "777" "augo+x" "rwxrwxrwx" "777" "go-xr" "rwx-w--w-" \
63 "777" "o-wx" "rwxrwxr--" "777" "ou-rx" "-w-rwx-w-" \
64 "777" "a+rwx" "rwxrwxrwx" "777" "u=rw" "rw-rwxrwx" \
65 "000" "123" "--x-w--wx" "000" "412" "r----x-w-" \
66 "231" "562" "r-xrw--w-" "712" "000" "---------" \
67 "777" "121" "--x-w---x" "123" "775" "rwxrwxr-x"
69 log_assert
" Verify chmod permission settings on files and directories for " \
74 # Verify file or directory have correct map after chmod
76 # $1 file or directory
78 function test_chmod_mapping
#<file-dir>
83 while ((i
< ${#argv[@]})); do
84 usr_exec
chmod ${argv[i]} $node
86 log_note
"usr_exec chmod ${argv[i]} $node"
89 usr_exec
chmod ${argv[((i + 1))]} $node
91 log_note
"usr_exec chmod ${argv[((i + 1))]} $node"
96 mode
=$
(get_mode
${node})
98 if [[ $mode != "-${argv[((i + 2))]}"* && \
99 $mode != "d${argv[((i + 2))]}"* ]]
101 log_fail
"FAIL: '${argv[i]}' '${argv[((i + 1))]}' \
102 '${argv[((i + 2))]}'"
111 # set aclmode=restricted
112 log_must zfs
set aclmode
=restricted
$TESTPOOL/$TESTFS
114 for user
in root
$ZFS_ACL_STAFF1; do
115 log_must set_cur_usr
$user
118 log_must usr_exec
touch $testfile
119 log_must test_chmod_mapping
$testfile
122 log_must usr_exec mkdir
$testdir
123 log_must test_chmod_mapping
$testdir
125 log_must usr_exec
rm $testfile
126 log_must usr_exec
rm -rf $testdir
129 log_pass
"Setting permissions using 'chmod' for aclmode=restricted completed " \