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 41tc_id="smbutil003" 42tc_desc="Verify smbutil login 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 50server=$(server_name) || return 51 52# clean up all the password 53smbutil logout -a 54cmd="$EXPECT $SMBUTILEXP $TUSER $TPASS" 55cti_execute_cmd $cmd 56if [[ $? != 0 ]]; then 57 cti_fail "FAIL: smbutil login failed to set passwd" 58 return 59else 60 cti_report "PASS: smbutil login succeed to set passwd" 61fi 62 63cmd="smbutil login -c $TUSER | grep exists" 64cti_execute_cmd $cmd 65if [[ $? != 0 ]]; then 66 cti_fail "FAIL: keychain doesn't exist" 67 return 68else 69 cti_report "PASS: the keychain doesn't exist" 70fi 71 72cmd="smbutil view //$TUSER@$server" 73cti_execute -i '' FAIL $cmd 74if [[ $? != 0 ]]; then 75 cti_fail "FAIL: smbutil can't view shares" 76 return 77else 78 cti_report "PASS: smbutil can view shares" 79fi 80 81parse_view_output public cti_stdout 82if [[ $? != 0 ]]; then 83 cti_fail "FAIL: smbutil view can't get the public share" 84 return 85else 86 cti_report "PASS: smbutil view can get the public share" 87fi 88 89smbutil logout -a 90 91cti_pass "${tc_id}: PASS" 92