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: smbmount_015
29 #
30 # DESCRIPTION:
31 # Verify smbmount can mount 2 private shares
32 #
33 # STRATEGY:
34 # 1. run "mount -F smbfs -o dirperms=777,fileperms=666
35 # //$AUSER:$APASS@$server/$AUSER $TMNT"
36 # 2 mount successfully
37 # 3. run "mount -F smbfs -o dirperms=777,fileperms=666
38 # //$BUSER:$BPASS@$server/$BUSER $TMNT2"
39 # 4 mount successfully
40 #
41
42 . $STF_SUITE/include/libtest.ksh
43
44 tc_id="smbmount015"
45 tc_desc="Verify smbmount can mount 2 private shares"
46 print_test_case $tc_id - $tc_desc
47
48 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
49 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
50 set -x
51 fi
52
53 server=$(server_name) || return
54
55 # SKIP for now (mount priv issues)
56 no_tested || return
57
58 testdir_init $TDIR
59 smbmount_clean $TMNT
60 smbmount_init $TMNT
61 smbmount_clean $TMNT2
62 smbmount_init $TMNT2
63
64 cmd="mount -F smbfs -o noprompt,dirperms=777,fileperms=666
65 //$AUSER:$APASS@$server/a_share $TMNT"
66 cti_execute -i '' FAIL $cmd
67 if [[ $? != 0 ]]; then
68 cti_fail "FAIL: smbmount can't mount the share a_share"
69 return
70 else
71 cti_report "PASS: smbmount can mount the share a_share"
72 fi
73
74 smbmount_check $TMNT || return
75
76 cmd="cp /usr/bin/ls $TMNT/ls_file"
77 cti_execute FAIL sudo -n -u $AUSER $cmd
78
79 cmd="diff /usr/bin/ls $TMNT/ls_file"
80 cti_execute FAIL sudo -n -u $AUSER $cmd
81
82 cmd="mount -F smbfs -o noprompt,dirperms=777,fileperms=666
83 //$BUSER:$BPASS@$server/$BUSER $TMNT2"
84 cti_execute -i '' FAIL $cmd
85
86 smbmount_check $TMNT || return
87
88 cmd="cp /usr/bin/ls $TMNT/ls_file"
89 cti_execute FAIL sudo -n -u $AUSER $cmd
90
91 cmd="diff /usr/bin/ls $TMNT/ls_file"
92 cti_execute FAIL sudo -n -u $AUSER $cmd
93
94 cmd="umount $TMNT"
95 cti_execute_cmd $cmd
96 if [[ $? != 0 ]]; then
97 cti_fail "FAIL: failed to umount the $TMNT"
98 return
99 else
100 cti_report "PASS: umount the $TMNT successfully"
101 fi
102
103 cmd="umount $TMNT2"
104 cti_execute_cmd $cmd
105 if [[ $? != 0 ]]; then
106 cti_fail "FAIL: failed to umount the $TMNT2"
107 return
108 cti_report "PASS: umount the $TMNT2 successfully"
109 fi
110
111 smbmount_clean $TMNT
112 smbmount_clean $TMNT2
113
114 cti_pass "${tc_id}: PASS"