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