1#!/bin/sh 2# Copyright (c) International Business Machines Corp., 2000 3# 4# This program is free software; you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation; either version 2 of the License, or 7# (at your option) any later version. 8# 9# This program is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 12# the GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program; if not, write to the Free Software 16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17# 18# 03/01 Robbie Williamson (robbiew@us.ibm.com) 19 20TCID="rlogin01" 21TST_TOTAL=1 22 23TST_USE_LEGACY_API=1 24. tst_net.sh 25 26setup() 27{ 28 tst_test_cmds rlogin expect 29 30 if [ -z $RUSER ]; then 31 RUSER=root 32 fi 33 34 if [ -z $PASSWD ]; then 35 tst_brkm TCONF "Please set PASSWD for $RUSER." 36 fi 37 38 if [ -z $RHOST ]; then 39 tst_brkm TCONF "Please set RHOST." 40 fi 41 42 if [ -z $LOOPCOUNT ]; then 43 LOOPCOUNT=25 44 fi 45} 46 47do_test() 48{ 49 tst_resm TINFO "Starting" 50 51 for i in $(seq 1 ${LOOPCOUNT}) 52 do 53 rlogin_test || return 1 54 done 55} 56 57rlogin_test() 58{ 59 tst_resm TINFO "login with rlogin($i/$LOOPCOUNT)" 60 61 expect -c " 62 spawn rlogin $RHOST -l $RUSER 63 64 expect { 65 \"Password:\" { 66 send \"$PASSWD\r\"; exp_continue 67 } \"incorrect\" { 68 exit 1 69 } \"$RUSER@\" { 70 send \"LC_ALL=C; ls -l /etc/hosts | \\ 71 wc -w > $RUSER.$RHOST\rexit\r\"; 72 exp_continue 73 } 74 } 75 " > /dev/null || return 1 76 77 tst_resm TINFO "checking telnet status($i/$LOOPCOUNT)" 78 tst_rhost_run -u $RUSER -c "grep -q 9 $RUSER.$RHOST" || return 1 79 tst_rhost_run -u $RUSER -c "rm -f $RUSER.$RHOST" 80} 81 82setup 83 84do_test 85if [ $? -ne 0 ]; then 86 tst_resm TFAIL "Test $TCID failed." 87else 88 tst_resm TPASS "Test $TCID succeeded." 89fi 90 91tst_exit 92