Merge remote-tracking branch 'origin/master'
[unleashed/lotheac.git] / usr / src / test / smbclient-tests / tests / smbmount / tp_smbmount_008.ksh
blob1bd320627d3028e660342773f4fe5186dc0aab49
1 #!/bin/ksh -p
3 # CDDL HEADER START
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]
20 # CDDL HEADER END
24 # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
28 # ID: smbmount_008
30 # DESCRIPTION:
31 # Verify normal smbmount can mount public share
33 # STRATEGY:
34 # 1. run sudo -u $TUSER "mount -F smbfs -ofileperms=666"
35 # //$TUSER:$TPASS@$server/public $TMNT""
36 # 2. mount successfully
37 # 3. run sudo -u $AUSER "cp /usr/bin/ls ls_file"
38 # 4. mount and cp can get right message
41 . $STF_SUITE/include/libtest.ksh
43 tc_id="smbmount008"
44 tc_desc="Verify normal smbmount can mount public share"
45 print_test_case $tc_id - $tc_desc
47 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
48 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
49 set -x
52 server=$(server_name) || return
54 testdir_init $TDIR
55 smbmount_clean $TMNT
56 smbmount_init $TMNT
58 sudo -n chown $TUSER $TMNT
60 cmd="mount -F smbfs -o noprompt,fileperms=666 \
61 //$TUSER:$TPASS@$server/public $TMNT"
62 cti_execute -i '' FAIL sudo -n $TUSER "$cmd"
63 if [[ $? != 0 ]]; then
64 cti_fail "FAIL: the normal user can't mount the public share"
65 smbmount_clean $TMNT
66 return
67 else
68 cti_report "PASS: the normal user can mount the public share"
71 smbmount_check $TMNT || return
73 cti_execute_cmd "rm -rf $TMNT/*"
75 cmd="cp /usr/bin/ls $TMNT/ls_file"
76 cti_execute FAIL sudo -n -u $AUSER $cmd
78 cmd="diff /usr/bin/ls $TMNT/ls_file"
79 cti_execute FAIL sudo -n -u $AUSER $cmd
81 cti_execute_cmd "rm $TMNT/ls_file"
83 cmd="umount $TMNT"
84 cti_execute_cmd "sudo -n -u $TUSER $cmd
85 if [[ $? != 0 ]]; then
86 cti_fail "FAIL: the normal user can't umount the public share"
87 smbmount_clean $TMNT
88 return
89 else
90 cti_report "PASS: the normal user can umount the public share"
93 smbmount_clean $TMNT
94 cti_pass "${tc_id}: PASS"