1 #!/bin/sh 2 # 3 # Copyright (c) International Business Machines Corp., 2003, 2005 4 # 5 # This program is free software; you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation; either version 2 of the License, or 8 # (at your option) any later version. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 13 # the GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with this program; if not, write to the Free Software 17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 # 19 # 20 # 21 # FILE : ftp 22 # 23 # PURPOSE: Ftp into a remote hosts successfully as a vaild user (other than root) 24 # 25 # HISTORY: 26 # 03/03 Jerone Young (jeroney (at] us.ibm.com) 27 # 04/03 Dustin Kirkland (k1rkland (at] us.ibm.com) 28 # 09/05 Kris Wilson (krisw (at] us.ibm.com) Check if vsftpd.conf was found. 29 # 30 # NOTE: 31 # This version is intended for EAL certification, it will need modification 32 # to conform with LTP standards in the offical LTP tree. 33 34 setup() 35 { 36 export TEST_USER="ftpuser3" 37 } 38 39 do_test() 40 { 41 FAIL_530="==> TEST : FAIL (ftp rejected login attempt)" 42 PASS_230="==> TEST : PASS (ftp allowed login attempt)" 43 FAIL_230="==> TEST : FAIL (ftp allowed login attempt)" 44 PASS_500="==> TEST : PASS (ftp rejected login attempt)" 45 PASS_530="==> TEST : PASS (ftp rejected login attempt)" 46 47 echo "TEST: Ftp into a remote host as a local user (other than root)," 48 echo "LOCAL_ENABLE=$LOCAL_ENABLE" 49 50 if [ "$LOCAL_ENABLE" = "YES" ]; then 51 expect -c " 52 spawn ftp $RHOST 53 sleep 1 54 expect -re \": \" 55 send \"$TEST_USER\r\" 56 expect -re \"Password:\" 57 send \"$TEST_USER_PASSWD\r\" 58 expect { 59 # 530 - Login failed 60 \"530\" {send_user \"$FAIL_530\n\";exit 1} 61 # 230 - Login successful 62 \"230\" {send_user \"$PASS_230\n\";exit 0} 63 } 64 expect \"ftp> \" 65 send \"quit\r\" 66 " 67 else 68 expect -c " 69 spawn ftp $RHOST 70 sleep 1 71 expect -re \": \" 72 send \"$TEST_USER\r\" 73 expect -re \"Password:\" 74 send \"$TEST_USER_PASSWD\r\" 75 expect { 76 # 230 - Login successful 77 \"230\" {send_user \"$FAIL_230\n\";exit 1} 78 # 500 - Login failed 79 \"500\" {send_user \"$PASS_500\n\";exit 0} 80 # 530 - Login failed 81 \"530\" {send_user \"$PASS_530\n\";exit 0} 82 } 83 expect \"ftp> \" 84 send \"quit\r\" 85 " 86 fi 87 } 88 89 TCID="ftp03" 90 TST_TOTAL=1 91 92 . test.sh 93 . ftp_setup 94 95 setup 96 do_setup 97 TST_CLEANUP=do_cleanup 98 99 do_test 100 if [ $? -ne 0 ]; then 101 tst_resm TFAIL "Test $TCID FAIL" 102 else 103 tst_resm TPASS "Test $TCID PASS" 104 fi 105 106 tst_exit 107