1#!/usr/local/bin/ksh93 -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# $FreeBSD$ 24 25# 26# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 27# Use is subject to license terms. 28# 29# ident "@(#)zfs_allow_007_pos.ksh 1.3 08/11/03 SMI" 30# 31 32. $STF_SUITE/tests/delegate/delegate_common.kshlib 33 34################################################################################# 35# 36# __stc_assertion_start 37# 38# ID: zfs_allow_007_pos 39# 40# DESCRIPTION: 41# Verify the permissions set will be masked on its descendent 42# datasets by same name set. 43# 44# STRATEGY: 45# 1. Create $ROOT_TESTFS/childfs 46# 2. Set permission $perms1 to @set on $ROOT_TESTFS 47# 3. Reset permission $perms2 to @set on $ROOT_TESTFS/childfs 48# 4. Allow @set to $STAFF1 on $ROOT_TESTFS/childfs 49# 5. Verify $perms2 is delegated on $ROOT_TESTFS/childfs and its 50# descendent. 51# 6. Allow @set to $STAFF1 on $ROOT_TESTFS 52# 7. Verify $perms1 is not appended to $STAFF1 on $ROOT_TESTFS/childfs and 53# its descendent since it is masked 54# 55# TESTABILITY: explicit 56# 57# TEST_AUTOMATION_LEVEL: automated 58# 59# CODING_STATUS: COMPLETED (2006-09-19) 60# 61# __stc_assertion_end 62# 63################################################################################ 64 65verify_runnable "both" 66 67log_assert "Verify permission set can be masked on descendent dataset." 68log_onexit restore_root_datasets 69 70typeset perms1="snapshot,reservation,compression" 71eval set -A dataset $DATASETS 72enc=$(get_prop encryption $dataset) 73if [[ $? -eq 0 ]] && [[ -n "$enc" ]] && [[ "$enc" != "off" ]]; then 74 typeset perms2="send,allow,userprop" 75else 76 typeset perms2="checksum,send,allow,userprop" 77fi 78 79# 80# Define three level filesystems 81# 82childfs=$ROOT_TESTFS/childfs 83grandchild=$childfs/grandchild 84log_must $ZFS create $childfs 85log_must $ZFS create $grandchild 86 87# 88# Setting different permissions to the same set on two level. 89# But only assign the user at one level. 90# 91log_must $ZFS allow -s @set $perms1 $ROOT_TESTFS 92log_must $ZFS allow -s @set $perms2 $childfs 93log_must $ZFS allow $STAFF1 @set $childfs 94 95# 96# Verify only perms2 is valid to user on the level which he was assigned. 97# 98log_must verify_noperm $ROOT_TESTFS $perms1 $STAFF1 99for fs in $childfs $grandchild ; do 100 log_must verify_noperm $childfs $perms1 $STAFF1 101 log_must verify_perm $childfs $perms2 $STAFF1 102done 103 104# 105# Delegate @set to STAFF1 on ROOT_TESTFS, verify $perms1 will not be appended 106# to its descendent datasets since it is masked 107# 108log_must $ZFS allow $STAFF1 @set $ROOT_TESTFS 109log_must verify_perm $ROOT_TESTFS $perms1 $STAFF1 110for fs in $childfs $grandchild ; do 111 log_must verify_noperm $childfs $perms1 $STAFF1 112 log_must verify_perm $childfs $perms2 $STAFF1 113done 114 115# Remove the mask, $perms1 will be allowed to its descendent datasets 116log_must $ZFS unallow -s @set $childfs 117for fs in $childfs $grandchild ; do 118 log_must verify_noperm $childfs $perms2 $STAFF1 119 log_must verify_perm $childfs $perms1 $STAFF1 120done 121 122log_pass "Verify permission set can be masked on descendetn dataset pass." 123