]> git.proxmox.com Git - mirror_zfs.git/blame - tests/zfs-tests/tests/functional/delegate/zfs_allow_003_pos.ksh
OpenZFS 7290 - ZFS test suite needs to control what utilities it can run
[mirror_zfs.git] / tests / zfs-tests / tests / functional / delegate / zfs_allow_003_pos.ksh
CommitLineData
6bb24f4d
BB
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#
c1d9abf9 29# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
6bb24f4d
BB
30#
31
32. $STF_SUITE/tests/functional/delegate/delegate_common.kshlib
33
34#
35# DESCRIPTION:
36# Verify option '-l' only allow permission to the dataset itself.
37#
38# STRATEGY:
39# 1. Create descendent datasets of $ROOT_TESTFS
40# 2. Select user, group and everyone and set local permission separately.
41# 3. Set locally permissions to $ROOT_TESTFS or $ROOT_TESTVOL.
42# 4. Verify the permissions are only allow on $ROOT_TESTFS or
43# $ROOT_TESTVOL.
44#
45
46verify_runnable "both"
47
48log_assert "Verify option '-l' only allow permission to the dataset itself."
49log_onexit restore_root_datasets
50
51childfs=$ROOT_TESTFS/childfs
52
53eval set -A dataset $DATASETS
54typeset perms="snapshot,reservation,compression,checksum,userprop"
55
c1d9abf9 56log_must zfs create $childfs
6bb24f4d
BB
57
58for dtst in $DATASETS ; do
c1d9abf9 59 log_must zfs allow -l $STAFF1 $perms $dtst
6bb24f4d
BB
60 log_must verify_perm $dtst $perms $STAFF1
61 if [[ $dtst == $ROOT_TESTFS ]] ; then
62 log_must verify_noperm $childfs $perms \
63 $STAFF1 $STAFF2 $OTHER1 $OTHER2
64 fi
65done
66
67log_must restore_root_datasets
68
c1d9abf9 69log_must zfs create $childfs
6bb24f4d 70for dtst in $DATASETS ; do
c1d9abf9 71 log_must zfs allow -l -g $STAFF_GROUP $perms $dtst
6bb24f4d
BB
72 log_must verify_perm $dtst $perms $STAFF1 $STAFF2
73 if [[ $dtst == $ROOT_TESTFS ]] ; then
74 log_must verify_noperm $childfs $perms \
75 $STAFF1 $STAFF2 $OTHER1 $OTHER2
76 fi
77done
78
79log_must restore_root_datasets
80
c1d9abf9 81log_must zfs create $childfs
6bb24f4d 82for dtst in $DATASETS ; do
c1d9abf9 83 log_must zfs allow -l -e $perms $dtst
6bb24f4d
BB
84 log_must verify_perm $dtst $perms $STAFF1 $STAFF2 $OTHER1 $OTHER2
85 if [[ $dtst == $ROOT_TESTFS ]] ; then
86 log_must verify_noperm $childfs $perms \
87 $STAFF1 $STAFF2 $OTHER1 $OTHER2
88 fi
89done
90
91log_must restore_root_datasets
92
93log_pass "Verify option '-l' only allow permission to the dataset itself pass."