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