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# Copyright 2018 Nexenta Systems, Inc. All rights reserved. 26# 27 28# 29# ID:nsmbrc003 30# 31# DESCRIPTION: 32# Verify password can work 33# 34# STRATEGY: 35# 1. create a .nsmbrc file 36# 2. run "smbutil logoutall" 37# 3. run "mount -F smbfs //$TUSER@$server/public $TMNT" 38# 4. smbutil and mount can get right message 39# 40 41. $STF_SUITE/include/libtest.ksh 42 43tc_id="nsmbrc003" 44tc_desc=" Verify password can work" 45print_test_case $tc_id - $tc_desc 46 47if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ 48 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then 49 set -x 50fi 51 52smbmount_clean $TMNT 53smbmount_init $TMNT 54 55server=$(server_name) || return 56 57cti_execute_cmd "rm -f ~/.nsmbrc" 58pass=$(smbutil crypt $TPASS) 59SERVER=$(echo $server | tr "[:lower:]" "[:upper:]") 60echo "[$SERVER:$TUSER]" > ~/.nsmbrc 61echo "addr=$server" >> ~/.nsmbrc 62echo "password=$pass" >> ~/.nsmbrc 63cti_execute_cmd "chmod 600 ~/.nsmbrc" 64 65smbutil logout -a 66 67# get rid of our connections 68cti_execute_cmd "smbutil discon //$TUSER@$server" 69cti_execute_cmd "smbutil discon //$TUSER1@$server" 70sleep 1 71 72cti_report "expect failure with $TUSER1" 73cmd="smbutil view -N //$TUSER1@$server" 74cti_execute -i '' PASS $cmd 75if [[ $? == 0 ]]; then 76 cti_fail "FAIL: $SERVER:$TUSER works for $TUSER1" 77 return 78else 79 cti_report "PASS: $SERVER:$TUSER does't work for $TUSER1" 80fi 81 82cti_report "expect success with $TUSER" 83cmd="truss -f -o smbutil.to smbutil view -N //$TUSER@$server" 84cti_execute -i '' PASS $cmd 85if [[ $? == 0 ]]; then 86 cti_pass "PASS: $SERVER:$TUSER works for $TUSER" 87else 88 cti_fail "FAIL: $SERVER:$TUSER does't work for $TUSER" 89 return 90fi 91 92cmd="mount -F smbfs //$TUSER@$server/public $TMNT" 93cti_execute -i '' FAIL $cmd 94if [[ $? != 0 ]]; then 95 cti_fail "FAIL: $SERVER:$TUSER does't work for $TUSER" 96 return 97else 98 cti_report "PASS: $SERVER:$TUSER works for $TUSER" 99fi 100 101smbmount_check $TMNT 102if [[ $? != 0 ]]; then 103 smbmount_clean $TMNT 104 return 105fi 106 107cti_execute_cmd "rm -f ~/.nsmbrc" 108smbmount_clean $TMNT 109 110cti_pass "${tc_id}: PASS" 111