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_001_neg.ksh 1.2 08/02/27 SMI" 30# 31 32. $STF_SUITE/include/libtest.kshlib 33. $STF_SUITE/tests/cli_user/cli_user.kshlib 34 35################################################################################ 36# 37# __stc_assertion_start 38# 39# ID: zfs_allow_001_neg 40# 41# DESCRIPTION: 42# 43# zfs allow returns an error when run as a user 44# 45# STRATEGY: 46# 47# 1. Verify that trying to show allows works as a user 48# 2. Verify that trying to set allows fails as a user 49# 50# 51# TESTABILITY: explicit 52# 53# TEST_AUTOMATION_LEVEL: automated 54# 55# CODING_STATUS: COMPLETED (2007-07-27) 56# 57# __stc_assertion_end 58# 59################################################################################ 60 61# check to see if we have zfs allow 62$ZFS 2>&1 | $GREP "allow" > /dev/null 63if (($? != 0)) then 64 log_unsupported "ZFS allow not supported on this machine." 65fi 66 67log_assert "zfs allow returns an error when run as a user" 68 69log_must run_unprivileged "$ZFS allow $TESTPOOL/$TESTFS" 70log_mustnot run_unprivileged "$ZFS allow `$LOGNAME` create $TESTPOOL/$TESTFS" 71 72# now verify that the above command actually did nothing by 73# checking for any allow output. ( if no allows are granted, 74# nothing should be output ) 75OUTPUT=$(run_unprivileged "$ZFS allow $TESTPOOL/$TESTFS" | $GREP "Local+Descendent" ) 76if [ -n "$OUTPUT" ] 77then 78 log_fail "zfs allow permissions were granted on $TESTPOOL/$TESTFS" 79fi 80 81log_pass "zfs allow returns an error when run as a user" 82 83