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/acl/acl_common.kshlib 28 29################################################################################ 30# 31# __stc_assertion_start 32# 33# ID: zfs_acl_ls_001_pos 34# 35# DESCRIPTION: 36# Verify that '/bin/ls' command option supports ZFS ACL 37# 38# STRATEGY: 39# 1. Create file and directory in zfs filesystem 40# 2. Verify that 'ls [-dv]' can list the ACEs of ACL of 41# file/directroy 42# 3. Change the file/directory's acl 43# 4. Verify that 'ls -l' can use the '+' to indicate the non-trivial 44# acl. 45# 46# TESTABILITY: explicit 47# 48# TEST_AUTOMATION_LEVEL: automated 49# 50# CODING_STATUS: COMPLETED (2005-10-11) 51# 52# __stc_assertion_end 53# 54################################################################################ 55 56verify_runnable "both" 57 58function cleanup 59{ 60 (( ${#cwd} != 0 )) && cd $cwd 61 [[ -d $TESTDIR ]] && log_must $RM -rf $TESTDIR/* 62 (( ${#mask} != 0 )) && log_must $UMASK $mask 63} 64 65log_assert "Verify that '$LS' command supports ZFS ACLs." 66log_onexit cleanup 67 68test_requires ZFS_ACL 69 70file=$TESTFILE0 71dir=dir.${TESTCASE_ID} 72cwd=$PWD 73mask=`$UMASK` 74spec_ace="everyone@:write_acl:allow" 75 76$UMASK 0022 77 78log_note "Create file and directory in the zfs filesystem. " 79cd $TESTDIR 80log_must $TOUCH $file 81log_must $MKDIR $dir 82 83log_note "Verify that '$LS [-dv]' can list file/directory ACEs of its acl." 84 85typeset -i ace_num=0 86for obj in $file $dir 87do 88 typeset ls_str="" 89 if [[ -f $obj ]]; then 90 ls_str="$LS -v" 91 else 92 ls_str="$LS -dv" 93 fi 94 95 for ace_type in "owner@" "group@" "everyone@" 96 do 97 $ls_str $obj | $GREP $ace_type > /dev/null 2>&1 98 (( $? == 0 )) && (( ace_num += 1 )) 99 done 100 101 (( ace_num < 1 )) && \ 102 log_fail "'$LS [-dv] fails to list file/directroy acls." 103done 104 105log_note "Verify that '$LS [-dl] [-dv]' can output '+' to indicate " \ 106 "the acl existent." 107 108for obj in $file $dir 109do 110 $CHMOD A0+$spec_ace $obj 111 112 log_must eval "$LS -ld -vd $obj | $GREP "+" > /dev/null" 113 log_must plus_sign_check_v $obj 114 115 log_must eval "$LS -ld -vd $obj | $GREP $spec_ace > /dev/null" 116 log_must plus_sign_check_l $obj 117done 118 119log_pass "'$LS' command succeeds to support ZFS ACLs." 120