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: smbutil_003
29 #
30 # DESCRIPTION:
31 # Verify smbutil login can work.
32 #
33 # STRATEGY:
34 # 1. run "smbutil login ..."
35 # 2. Verify with "smbutil login -c ..."
36 # 3. Verify smbutil view can authenticate
37 #
38
39 . $STF_SUITE/include/libtest.ksh
40
41 tc_id="smbutil003"
42 tc_desc="Verify smbutil login works"
43 print_test_case $tc_id - $tc_desc
44
45 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
46 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
47 set -x
48 fi
49
50 server=$(server_name) || return
51
52 # clean up all the password
53 smbutil logout -a
54 cmd="$EXPECT $SMBUTILEXP $TUSER $TPASS"
55 cti_execute_cmd $cmd
56 if [[ $? != 0 ]]; then
57 cti_fail "FAIL: smbutil login failed to set passwd"
58 return
59 else
60 cti_report "PASS: smbutil login succeed to set passwd"
61 fi
62
63 cmd="smbutil login -c $TUSER | grep exists"
64 cti_execute_cmd $cmd
65 if [[ $? != 0 ]]; then
66 cti_fail "FAIL: keychain doesn't exist"
67 return
68 else
69 cti_report "PASS: the keychain doesn't exist"
70 fi
71
72 cmd="smbutil view //$TUSER@$server"
73 cti_execute -i '' FAIL $cmd
74 if [[ $? != 0 ]]; then
75 cti_fail "FAIL: smbutil can't view shares"
76 return
77 else
78 cti_report "PASS: smbutil can view shares"
79 fi
80
81 parse_view_output public cti_stdout
82 if [[ $? != 0 ]]; then
83 cti_fail "FAIL: smbutil view can't get the public share"
84 return
85 else
86 cti_report "PASS: smbutil view can get the public share"
87 fi
88
89 smbutil logout -a
90
91 cti_pass "${tc_id}: PASS"