7290 ZFS test suite needs to control what utilities it can run
[unleashed.git] / usr / src / test / zfs-tests / tests / functional / delegate / zfs_allow_005_pos.ksh
blob3feb598c4cedba06ca23e9036f820e4dff847c9a
1 #!/bin/ksh -p
3 # CDDL HEADER START
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]
20 # CDDL HEADER END
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.
32 . $STF_SUITE/tests/functional/delegate/delegate_common.kshlib
35 # DESCRIPTION:
36 # Verify option '-c' will be granted locally to the creator on any
37 # newly-created descendent file systems.
39 # STRATEGY:
40 # 1. Allow create permissions to everyone on $ROOT_TESTFS locally.
41 # 2. Allow '-c' create to $ROOT_TESTFS.
42 # 3. chmod 777 the mountpoint of $ROOT_TESTFS
43 # 4. Verify only creator can create descendent dataset on
44 # $ROOT_TESTFS/$user.
47 verify_runnable "both"
49 log_assert "Verify option '-c' will be granted locally to the creator."
50 log_onexit restore_root_datasets
52 eval set -A dataset $DATASETS
53 typeset perms="snapshot,reservation,compression,checksum,userprop"
55 log_must zfs allow -l everyone create,mount $ROOT_TESTFS
56 log_must zfs allow -c $perms $ROOT_TESTFS
58 mntpnt=$(get_prop mountpoint $ROOT_TESTFS)
59 log_must chmod 777 $mntpnt
61 for user in $EVERYONE; do
62 childfs=$ROOT_TESTFS/$user
64 user_run $user zfs create $childfs
66 for other in $EVERYONE; do
68 # Verify only the creator has the $perm time permissions.
70 if [[ $other == $user ]]; then
71 log_must verify_perm $childfs $perms $user
72 else
73 log_must verify_noperm $childfs $perms $other
75 done
76 done
78 log_pass "Verify option '-c' will be granted locally to the creator passed."