xref: /illumos-gate/usr/src/test/smbclient-tests/tests/smbutil/tp_smbutil_015.ksh (revision 142d813a06c6f9a6142e2c276b62129a17a31a65)
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_015
29#
30# DESCRIPTION:
31#        1. Do stress testing on smbutil
32#	 2. Verify smbutil logout -a work well
33#
34# STRATEGY:
35#	1. run "smbutil logout -a" and "smbutil login -c"
36#	2. the smbutil commands can get right message
37#
38
39. $STF_SUITE/include/libtest.ksh
40
41tc_id="smbutil015"
42tc_desc="Verify smbutil logout -a works"
43print_test_case $tc_id - $tc_desc
44
45if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
46	[[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
47    set -x
48fi
49
50sleep 3
51
52smbutil logout -a
53
54i=0
55while ((i<20));do
56	cmd="$EXPECT $SMBUTILEXP $TUSER$i \$TPASS\$i"
57	cti_execute_cmd $cmd
58	if [[ $? != 0 ]]; then
59		cti_fail "FAIL: smbutil login failed to set passwd to $TUSER$i"
60		return
61	else
62		cti_report "PASS: smbutil login failed to set passwd to $TUSER$i"
63	fi
64
65	cmd="smbutil login -c $TUSER$i | grep exists"
66	cti_execute_cmd $cmd
67	if [[ $? != 0 ]]; then
68		cti_fail "FAIL: '$TUSER$i' keychain doesn't exist"
69		return
70	else
71		cti_report "PASS: '$TUSER$i' keychain exists"
72	fi
73	((i=i+1))
74done
75
76i=0
77while ((i<20));do
78	cmd="smbutil logout $TUSER$i"
79	cti_execute_cmd $cmd
80	if [[ $? != 0 ]]; then
81		cti_fail "FAIL: smbutil logout $TUSER$i failed"
82	        return
83	else
84		cti_report "PASS: smbutil logout $TUSER$i succeeded"
85	fi
86	cmd="smbutil login -c $TUSER$i | grep exists"
87	cti_execute_cmd $cmd
88	if [[ $? == 0 ]]; then
89		cti_fail "FAIL: '$TUSER$i' keychain exists"
90		return
91	else
92		cti_report "PASS: '$TUSER$i' keychain doesn't exist"
93	fi
94	((i=i+1))
95done
96
97cti_execute_cmd "smbutil logout -a"
98if [[ $? != 0 ]]; then
99	cti_fail "FAIL: smbutil logout -a doesn't work"
100	return
101else
102	cti_report "PASS: smbutil logout -a works"
103fi
104
105while ((i<20)); do
106	cmd="smbutil login -c $TUSER$i|grep exists"
107	cti_execute_cmd $cmd
108	if [[ $? == 0 ]]; then
109		cti_fail "FAIL: '$TUSER$i' keychain exists"
110	        return
111	else
112		cti_report "PASS: '$TUSER$i' keychain doesn't exist"
113	fi
114	((i=i+1))
115done
116
117cti_pass "${tc_id}: PASS"
118