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 2012 Spectra Logic. All rights reserved. 25# Use is subject to license terms. 26# 27# 28. $STF_SUITE/include/libtest.kshlib 29 30################################################################################ 31# 32# __stc_assertion_start 33# 34# ID: snapshot_018_pos 35# 36# DESCRIPTION: 37# Snapshot directory supports ACL operations 38# 39# STRATEGY: 40# 1. Create a dataset 41# 2. Set the snapdir property to visible 42# 3. Use getconf to verify that acls are supported 43# 4. Use getfacl to verify that the acl can be read 44# 5. Verify that the acl is correct 45# 6. Verify that ls doesn't print any errors because acl_get_link fails 46# 47# TESTABILITY: explicit 48# 49# TEST_AUTOMATION_LEVEL: automated 50# 51# CODING_STATUS: COMPLETED (2013-01-03) 52# 53# __stc_assertion_end 54# 55################################################################################ 56 57verify_runnable "both" 58 59log_assert "Verify that the snapshot directory supports ACL operations" 60 61log_must dataset_setprop $TESTPOOL/$TESTFS "snapdir" "visible" 62 63function verify_dir # directory 64{ 65 typeset DIR=$1 66 # 3. Verify that ACLs are supported by the ctldir 67 log_must $GETCONF TRUSTEDBSD_ACL_EXTENDED $DIR 68 # 4. Verify that we can read ACLs 69 log_must $GETFACL $DIR 70 # 5. Verify that the ACLs are correct 71 typeset PROG_DIR=$STF_SUITE/tests/snapshot 72 typeset SUM=$($SHA1 -q $PROG_DIR/ctldir_acl.txt) 73 if [[ $( $GETFACL -q $DIR | $SHA1 -q ) != $SUM ]]; then 74 log_fail "ACL is incorrect" 75 fi 76 77} 78 79typeset -a dirlist 80dirlist=( "$TESTDIR/.zfs" "$TESTDIR/.zfs/snapshot" ) 81ctldir=".zfs" 82for d in ${dirlist[@]}; do 83 verify_dir $d 84done 85 86# 6. Check for errors with ls 87LS_STDERR=$( $LS -la $TESTDIR/$ctldir 2>&1 > /dev/null) 88LS_R_STDERR=$( $LS -lar $TESTDIR/$ctldir 2>&1 > /dev/null) 89if [[ -n $LS_STDERR || -n $LS_R_STDERR ]]; then 90 log_fail "ls encountered errors" 91fi 92 93log_pass 94