blob: e2925e8e670f5ae08f523bfb085b158922d0bacc [file] [log] [blame]
#!/bin/sh
#
# Copyright (c) International Business Machines Corp., 2003, 2005
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
#
#
# FILE : ftp
#
# PURPOSE: Ftp into a remote hosts successfully as a vaild user (other than root)
#
# HISTORY:
# 03/03 Jerone Young (jeroney@us.ibm.com)
# 04/03 Dustin Kirkland (k1rkland@us.ibm.com)
# 09/05 Kris Wilson (krisw@us.ibm.com) Check if vsftpd.conf was found.
#
# NOTE:
# This version is intended for EAL certification, it will need modification
# to conform with LTP standards in the offical LTP tree.
setup()
{
export TEST_USER="ftpuser3"
}
do_test()
{
FAIL_530="==> TEST : FAIL (ftp rejected login attempt)"
PASS_230="==> TEST : PASS (ftp allowed login attempt)"
FAIL_230="==> TEST : FAIL (ftp allowed login attempt)"
PASS_500="==> TEST : PASS (ftp rejected login attempt)"
PASS_530="==> TEST : PASS (ftp rejected login attempt)"
echo "TEST: Ftp into a remote host as a local user (other than root),"
echo "LOCAL_ENABLE=$LOCAL_ENABLE"
if [ "$LOCAL_ENABLE" = "YES" ]; then
expect -c "
spawn ftp $RHOST
sleep 1
expect -re \": \"
send \"$TEST_USER\r\"
expect -re \"Password:\"
send \"$TEST_USER_PASSWD\r\"
expect {
# 530 - Login failed
\"530\" {send_user \"$FAIL_530\n\";exit 1}
# 230 - Login successful
\"230\" {send_user \"$PASS_230\n\";exit 0}
}
expect \"ftp> \"
send \"quit\r\"
"
else
expect -c "
spawn ftp $RHOST
sleep 1
expect -re \": \"
send \"$TEST_USER\r\"
expect -re \"Password:\"
send \"$TEST_USER_PASSWD\r\"
expect {
# 230 - Login successful
\"230\" {send_user \"$FAIL_230\n\";exit 1}
# 500 - Login failed
\"500\" {send_user \"$PASS_500\n\";exit 0}
# 530 - Login failed
\"530\" {send_user \"$PASS_530\n\";exit 0}
}
expect \"ftp> \"
send \"quit\r\"
"
fi
}
TCID="ftp03"
TST_TOTAL=1
. test.sh
. ftp_setup
setup
do_setup
TST_CLEANUP=do_cleanup
do_test
if [ $? -ne 0 ]; then
tst_resm TFAIL "Test $TCID FAIL"
else
tst_resm TPASS "Test $TCID PASS"
fi
tst_exit