1 #!/bin/ksh -p
2
3 #
4 # CDDL HEADER START
5 #
6 # The contents of this file are subject to the terms of the
7 # Common Development and Distribution License (the "License").
8 # You may not use this file except in compliance with the License.
9 #
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
14 #
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
20 #
21 # CDDL HEADER END
22 #
23
24 #
25 # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
26 #
27
28 #
29 # ID: sharectl_006
30 #
31 # DESCRIPTION:
32 # Verify user and domain can work in sharectl "$SERVER" section
33 #
34 # STRATEGY:
35 # 1. run "sharectl set -p section=$SERVER -p password=$pass smbfs"
36 # 2. run "sharectl set -p section=$SERVER -p user=$TUSER smbfs"
37 # 3. run "sharectl set -p section=$SERVER -p domain=mydomain smbfs"
38 # 4. run "smbutil view //$server"
39 # 5. run "mount -F smbfs //$server/public $TMNT"
40 # 3. sharectl, smbutil and mount can get right message
41 #
42
43 . $STF_SUITE/include/libtest.ksh
44
45 tc_id="sharectl006"
46 tc_desc="Test user and domain in sharectl [server] section."
47 print_test_case $tc_id - $tc_desc
48
49 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
50 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
51 set -x
52 fi
53
54 server=$(server_name) || return
55
56 smbmount_clean $TMNT
57 smbmount_init $TMNT
58
59 pass=$(smbutil crypt $TPASS)
60 SERVER=$(echo $server|tr "[:lower:]" "[:upper:]")
61
62 cmd="sharectl set -p section=$SERVER -p password=\$pass smbfs"
63 cti_execute_cmd $cmd
64 if [[ $? != 0 ]]; then
65 cti_fail "FAIL: sharectl set password in SERVER section failed"
66 sharectl delsect $SERVER smbfs
67 return
68 else
69 cti_report "PASS: sharectl set password in SERVER section succeeded"
70 fi
71
72 cmd="sharectl set -p section=$SERVER -p user=$TUSER smbfs"
73 cti_execute_cmd $cmd
74 if [[ $? != 0 ]]; then
75 cti_fail "FAIL: sharectl set user in SERVER section failed"
76 sharectl delsect $SERVER smbfs
77 return
78 else
79 cti_report "PASS: sharectl set user in SERVER section succeeded"
80 fi
81
82 cmd="sharectl set -p section=$SERVER -p domain=mydomain smbfs"
83 cti_execute_cmd $cmd
84 if [[ $? != 0 ]]; then
85 cti_fail "FAIL: sharectl set user in SERVER section failed"
86 sharectl delsect $SERVER smbfs
87 return
88 else
89 cti_report "PASS: sharectl set user in SERVER section succeeded"
90 fi
91
92 cmd="smbutil view //$server"
93 cti_execute -i '' FAIL $cmd
94 if [[ $? != 0 ]]; then
95 cti_fail "FAIL: smbutil view failed for user and domain properity"
96 sharectl delsect $SERVER smbfs
97 return
98 else
99 cti_report "PASS: smbutil view succeeded for user and domain properity"
100 fi
101
102 cmd="mount -F smbfs //$server/public $TMNT"
103 cti_execute -i '' FAIL $cmd
104 if [[ $? != 0 ]]; then
105 cti_fail "FAIL: smbmount can't mount the public share"
106 sharectl delsect $SERVER smbfs
107 return
108 else
109 cti_report "PASS: smbmount can mount the public share"
110 fi
111
112 smbmount_check $TMNT
113 if [[ $? != 0 ]]; then
114 smbmount_clean $TMNT
115 sharectl delsect $SERVER smbfs
116 return
117 fi
118
119 smbmount_clean $TMNT
120 sharectl delsect $SERVER smbfs
121
122 cti_pass "${tc_id}: PASS"