]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/delegate/zfs_allow_005_pos.ksh
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / delegate / zfs_allow_005_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 #
24 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
25 # Use is subject to license terms.
26 #
27
28 #
29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
30 #
31
32 . $STF_SUITE/tests/functional/delegate/delegate_common.kshlib
33
34 #
35 # DESCRIPTION:
36 #       Verify option '-c' will be granted locally to the creator on any
37 #       newly-created descendent file systems.
38 #
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.
45 #
46
47 verify_runnable "both"
48
49 log_assert "Verify option '-c' will be granted locally to the creator."
50 log_onexit restore_root_datasets
51
52 eval set -A dataset $DATASETS
53 typeset perms="snapshot,reservation,compression,checksum,userprop"
54
55 log_must zfs allow -l everyone create,mount $ROOT_TESTFS
56 log_must zfs allow -c $perms $ROOT_TESTFS
57
58 mntpnt=$(get_prop mountpoint $ROOT_TESTFS)
59 log_must chmod 777 $mntpnt
60
61 for user in $EVERYONE; do
62         childfs=$ROOT_TESTFS/$user
63
64         user_run $user zfs create $childfs
65
66         for other in $EVERYONE; do
67                 #
68                 # Verify only the creator has the $perm time permissions.
69                 #
70                 if [[ $other == $user ]]; then
71                         log_must verify_perm $childfs $perms $user
72                 else
73                         log_must verify_noperm $childfs $perms $other
74                 fi
75         done
76 done
77
78 log_pass "Verify option '-c' will be granted locally to the creator passed."