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.
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.
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]
24 # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
31 # Verify we can take ownership (chown)
34 # 1. run "mount -F smbfs //$TUSER@..." $TMNT
35 # 2. run "mount -F smbfs //$TUSER1@..." $TMNT2
36 # 3. create file2, as $TUSER1 and get owner UID
37 # 4. create a file as $TUSER
38 # 5. give $TUSER1 full control
39 # 6. chown UID $TMNT2/file
40 # 7. verify $TUSER1 owns it
43 .
$STF_SUITE/include
/libtest.ksh
46 tc_desc
="Verify we can take ownership (chown)"
47 print_test_case
$tc_id - $tc_desc
49 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
50 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
54 server
=$
(server_name
) ||
return
62 # 1. run "mount -F smbfs //$TUSER@..." $TMNT
64 cmd
="mount -F smbfs -oacl //$TUSER:$TPASS@$server/public $TMNT"
65 cti_execute
-i '' FAIL
$cmd
66 if [[ $?
!= 0 ]]; then
70 cti_report
"PASS: $cmd"
73 # Require that the mount supports ACLs
74 smbmount_getmntopts
$TMNT |
grep /acl
/ >/dev
/null
75 if [[ $?
!= 0 ]]; then
77 cti_unsupported
"UNSUPPORTED (no ACLs in this mount)"
81 # 2. run "mount -F smbfs //$TUSER1@..." $TMNT2
83 cmd
="mount -F smbfs -oacl //$TUSER1:$TPASS@$server/public $TMNT2"
84 cti_execute
-i '' FAIL
$cmd
85 if [[ $?
!= 0 ]]; then
90 cti_report
"PASS: $cmd"
93 # 3. create a file2 as $TUSER1 and get owner UID
95 cmd
="touch $TMNT2/${tc_id}B"
97 if [[ $?
!= 0 ]]; then
100 smbmount_clean
$TMNT2
103 cmd
="ls -l $TMNT/${tc_id}B"
105 if [[ $?
!= 0 ]]; then
106 cti_fail
"FAIL: $cmd"
108 smbmount_clean
$TMNT2
111 # Get the ephemereal UID and GID for $TUSER1
112 read mode cnt uid gid junk
< cti_stdout
113 cti_execute_cmd
"rm $TMNT2/${tc_id}B"
115 # 4. create a file, as $TUSER
117 cmd
="cp /etc/passwd $TMNT/$tc_id"
119 if [[ $?
!= 0 ]]; then
120 cti_fail
"FAIL: $cmd"
122 smbmount_clean
$TMNT2
125 cmd
="ls -l $TMNT/$tc_id"
127 if [[ $?
!= 0 ]]; then
128 cti_fail
"FAIL: $cmd"
130 smbmount_clean
$TMNT2
133 cp cti_stdout out_save
135 # 5. give $TUSER1 full control
136 cmd
="chmod A+user:${uid}:rwxpdDaARWcCos::allow $TMNT/$tc_id"
138 if [[ $?
!= 0 ]]; then
139 cti_fail
"FAIL: $cmd"
141 smbmount_clean
$TMNT2
145 # 6. chown UID $TMNT2/file
147 cmd
="sudo -n chown ${uid} $TMNT2/$tc_id"
149 if [[ $?
!= 0 ]]; then
150 cti_fail
"FAIL: $cmd"
152 smbmount_clean
$TMNT2
156 # 6. verify $TUSER1 owns it
158 cmd
="ls -l $TMNT2/$tc_id"
160 if [[ $?
!= 0 ]]; then
161 cti_fail
"FAIL: $cmd"
163 smbmount_clean
$TMNT2
166 cp cti_stdout out_test
168 # The new owner should be different...
169 cmd
="diff out_save out_test"
171 if [[ $?
== 0 ]]; then
172 cti_fail
"FAIL: owner should have changed"
174 smbmount_clean
$TMNT2
178 # The new owner should contain $uid
179 grep " $uid " out_test
>/dev
/null
180 if [[ $?
!= 0 ]]; then
181 cti_fail
"FAIL: did not find $uid"
183 smbmount_clean
$TMNT2
187 cti_execute_cmd
"rm $TMNT/$tc_id"
189 smbmount_clean
$TMNT2
191 cti_pass
"${tc_id}: PASS"