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# 24# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26 27. $STF_SUITE/tests/delegate/delegate_common.kshlib 28 29################################################################################# 30# 31# __stc_assertion_start 32# 33# ID: zfs_allow_008_pos 34# 35# DESCRIPTION: 36# non-root user can allow any permissions which he is holding to 37# other else user when it get 'allow' permission. 38# 39# STRATEGY: 40# 1. Set two set permissions to two datasets locally. 41# 2. Verify the non-root user can allow permission if he has allow 42# permission. 43# 44# TESTABILITY: explicit 45# 46# TEST_AUTOMATION_LEVEL: automated 47# 48# CODING_STATUS: COMPLETED (2006-09-20) 49# 50# __stc_assertion_end 51# 52################################################################################ 53 54verify_runnable "both" 55 56log_assert "Verify non-root user can allow permissions." 57log_onexit restore_root_datasets 58 59perms1="snapshot,reservation" 60perms2="send,compression,checksum,userprop" 61childfs=$ROOT_TESTFS/childfs 62 63log_must $ZFS create $childfs 64 65for dtst in $DATASETS ; do 66 # Delegate local permission to $STAFF1 67 log_must $ZFS allow -l $STAFF1 $perms1 $dtst 68 log_must $ZFS allow -l $STAFF1 allow $dtst 69 70 if [[ $dtst == $ROOT_TESTFS ]]; then 71 log_must $ZFS allow -l $STAFF1 $perms2 $childfs 72 # $perms1 is local permission in $ROOT_TESTFS 73 log_mustnot user_run $STAFF1 $ZFS allow $OTHER1 $perms1 $childfs 74 log_must verify_noperm $childfs $perms1 $OTHER1 75 fi 76 77 # Verify 'allow' give non-privilege user delegated permission. 78 log_must user_run $STAFF1 $ZFS allow -l $OTHER1 $perms1 $dtst 79 log_must verify_perm $dtst $perms1 $OTHER1 80 81 # $perms2 was not allow to $STAFF1, so he have no permission to 82 # delegate permission to other else. 83 log_mustnot user_run $STAFF1 $ZFS allow $OTHER1 $perms2 $dtst 84 log_must verify_noperm $dtst $perms2 $OTHER1 85done 86 87log_pass "Verify non-root user can allow permissions passed." 88