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 (at] us.ibm.com) 19 20 TCID="rlogin01" 21 TST_TOTAL=1 22 23 . test_net.sh 24 25 setup() 26 { 27 tst_check_cmds rlogin expect 28 29 if [ -z $RUSER ]; then 30 RUSER=root 31 fi 32 33 if [ -z $PASSWD ]; then 34 tst_brkm TCONF "Please set PASSWD for $RUSER." 35 fi 36 37 if [ -z $RHOST ]; then 38 tst_brkm TCONF "Please set RHOST." 39 fi 40 41 if [ -z $LOOPCOUNT ]; then 42 LOOPCOUNT=25 43 fi 44 } 45 46 do_test() 47 { 48 tst_resm TINFO "Starting" 49 50 for i in $(seq 1 ${LOOPCOUNT}) 51 do 52 rlogin_test || return 1 53 done 54 } 55 56 rlogin_test() 57 { 58 tst_resm TINFO "login with rlogin($i/$LOOPCOUNT)" 59 60 expect -c " 61 spawn rlogin $RHOST -l $RUSER 62 63 expect { 64 \"Password:\" { 65 send \"$PASSWD\r\"; exp_continue 66 } \"incorrect\" { 67 exit 1 68 } \"$RUSER@\" { 69 send \"LC_ALL=C; ls -l /etc/hosts | \\ 70 wc -w > $RUSER.$RHOST\rexit\r\"; 71 exp_continue 72 } 73 } 74 " > /dev/null || return 1 75 76 tst_resm TINFO "checking telnet status($i/$LOOPCOUNT)" 77 tst_rhost_run -u $RUSER -c "grep -q 9 $RUSER.$RHOST" || return 1 78 tst_rhost_run -u $RUSER -c "rm -f $RUSER.$RHOST" 79 } 80 81 setup 82 83 do_test 84 if [ $? -ne 0 ]; then 85 tst_resm TFAIL "Test $TCID failed." 86 else 87 tst_resm TPASS "Test $TCID succeeded." 88 fi 89 90 tst_exit 91