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 2010 Sun Microsystems, Inc. All rights reserved. 25# 26 27# 28# ID: acl_003 29# 30# DESCRIPTION: 31# Verify we can modify an ACL (add everyone ACE) 32# 33# STRATEGY: 34# 1. run "mount -F smbfs ..." 35# 2. create a file, make sure it has an ACL 36# 3. chmod A+everyone@:rxaRcs::allow file 37# 4. verify everyone line is there 38# 39 40. $STF_SUITE/include/libtest.ksh 41 42tc_id="acl003" 43tc_desc="Verify we can modify an ACL (add everyone ACE)" 44print_test_case $tc_id - $tc_desc 45 46if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ 47 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then 48 set -x 49fi 50 51server=$(server_name) || return 52 53smbmount_clean $TMNT 54smbmount_init $TMNT 55 56cmd="mount -F smbfs -oacl //$TUSER:$TPASS@$server/public $TMNT" 57cti_execute -i '' FAIL $cmd 58if [[ $? != 0 ]]; then 59 cti_fail "FAIL: $cmd" 60 return 61else 62 cti_report "PASS: $cmd" 63fi 64 65# Require that the mount supports ACLs 66smbmount_getmntopts $TMNT |grep /acl/ >/dev/null 67if [[ $? != 0 ]]; then 68 smbmount_clean $TMNT 69 cti_unsupported "UNSUPPORTED (no ACLs in this mount)" 70 return 71fi 72 73# create a file, make sure it has an ACL 74cmd="cp /etc/passwd $TMNT/$tc_id" 75cti_execute_cmd $cmd 76if [[ $? != 0 ]]; then 77 cti_fail "FAIL: $cmd" 78 smbmount_clean $TMNT 79 return 80fi 81cmd="ls -V $TMNT/$tc_id" 82cti_execute_cmd $cmd 83if [[ $? != 0 ]]; then 84 cti_fail "FAIL: $cmd" 85 smbmount_clean $TMNT 86 return 87fi 88tail +2 cti_stdout > acl_save 89 90# 3. chmod A+everyone@:rxaRcs::allow file 91cmd="chmod A+everyone@:rxaRcs::allow $TMNT/$tc_id" 92cti_execute_cmd $cmd 93if [[ $? != 0 ]]; then 94 cti_fail "FAIL: $cmd" 95 smbmount_clean $TMNT 96 return 97fi 98 99# 4. verify everyone line is there 100cmd="ls -V $TMNT/$tc_id" 101cti_execute_cmd $cmd 102if [[ $? != 0 ]]; then 103 cti_fail "FAIL: $cmd" 104 smbmount_clean $TMNT 105 return 106fi 107tail +2 cti_stdout > acl_test 108 109# The new ACL should be different, and should contain "everyone@" 110cmd="diff acl_save acl_test" 111cti_execute_cmd $cmd 112if [[ $? == 0 ]]; then 113 cti_fail "FAIL: ACL should have changed" 114 smbmount_clean $TMNT 115 return 116fi 117 118grep ' everyone@:' acl_test >/dev/null 119if [[ $? != 0 ]]; then 120 cti_fail "FAIL: did not find new ACE" 121 smbmount_clean $TMNT 122 return 123fi 124 125cti_execute_cmd "rm $TMNT/$tc_id" 126smbmount_clean $TMNT 127 128cti_pass "${tc_id}: PASS" 129