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 smbutil logout -a can works
34 # 1. run "smbutil login -c $TUSER"
35 # 2. smbutil login and smbutil view can get right message
36 # 3. smbutil logout -a can get right message
39 .
$STF_SUITE/include
/libtest.ksh
42 tc_desc
="Verify smbutil login -a works"
43 print_test_case
$tc_id - $tc_desc
45 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
46 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
50 server
=$
(server_name
) ||
return
53 sudo
-n smbutil logoutall
55 cmd
="$EXPECT $SMBUTILEXP $TUSER \$TPASS"
57 if [[ $?
!= 0 ]]; then
58 cti_fail
"FAIL: smbutil login failed to set password for user '$TUSER'"
61 cti_report
"PASS: smbutil login successfully set password for user '$TUSER'"
64 cmd
="smbutil login -c $TUSER | grep exists"
66 if [[ $?
!= 0 ]]; then
67 cti_fail
"FAIL: keychain doesn't exist"
70 cti_report
"PASS: keychain exists"
73 cmd
="smbutil view //$TUSER@$server"
74 cti_execute
-i '' FAIL
$cmd
75 if [[ $?
!= 0 ]]; then
76 cti_fail
"FAIL: smbutil can view the shares"
79 cti_report
"PASS: smbutil can't view the shares"
82 parse_view_output public cti_stdout
83 if [[ $?
!= 0 ]]; then
84 cti_fail
"FAIL: smbutil view can't get the public share"
87 cti_report
"PASS: smbutil view can get the public share"
90 cmd
="$EXPECT $SMBUTILEXP $AUSER $APASS"
92 if [[ $?
!= 0 ]]; then
93 cti_fail
"FAIL: smbutil login failed to set passwd to $AUSER"
96 cti_report
"PASS: smbutil login succeeded to set passwd to $AUSER"
99 cmd
="smbutil login -c $AUSER | grep exists"
101 if [[ $?
!= 0 ]]; then
102 cti_fail
"FAIL: '$AUSER' keychain doesn't exist"
105 cti_report
"PASS: '$AUSER' keychain exists"
108 cmd
="smbutil view //$AUSER@$server"
109 cti_execute
-i '' FAIL
$cmd
110 if [[ $?
!= 0 ]]; then
111 cti_fail
"FAIL: smbutil can't view shares"
114 cti_report
"PASS: smbutil can view shares"
117 parse_view_output public cti_stdout
118 if [[ $?
!= 0 ]]; then
119 cti_fail
"FAIL: smbutil can't get the public share"
122 cti_report
"PASS: smbutil can get the public share"
125 cti_execute_cmd
"smbutil logout -a"
126 if [[ $?
!= 0 ]]; then
127 cti_fail
"FAIL: smbutil logout -a doesn't work"
130 cti_report
"smbutil logout -a works"
133 cmd
="smbutil login -c $TUSER | grep exists"
135 if [[ $?
== 0 ]]; then
136 cti_fail
"FAIL: '$TUSER' keychain exists"
139 cti_report
"PASS: '$TUSER' keychain doesn't exist"
142 cmd
="smbutil login -c $AUSER | grep exists"
144 if [[ $?
== 0 ]]; then
145 cti_fail
"FAIL: '$AUSER' keychain exists"
148 cti_report
"PASS: '$AUSER' keychain doesn't exist"
151 cti_pass
"${tc_id}: PASS"