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