ftp02 revision 6518012db8b99b04ef3e4df22aefe82fa487b809
1#!/bin/sh
2#
3#   Copyright (c) International Business Machines  Corp., 2003
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18#
19#
20#
21#  FILE   : ftp
22#
23#  PURPOSE: Test to see if ftp rejects a user with an invalid password 
24#
25#  HISTORY:
26#     03/03  Jerone Young (jeroney@us.ibm.com)
27#
28#  NOTE:
29#       This version is intended for EAL certification, it will need modification
30#       to conform with LTP standards in the offical LTP tree.
31
32#-----------------------------------------------------------------------
33# FUNCTION:  do_setup
34#-----------------------------------------------------------------------
35
36do_setup()
37{
38
39    export RHOST="localhost"
40    export TEST_USER="ftpuser2"
41    export TEST_USER_PASSWD="eal"
42    export TEST_USER_ENCRYPTED_PASSWD="42VmxaOByKwlA"
43    export TEST_USER_HOMEDIR="/home/$TEST_USER"
44
45    # erase user if he may exist, so we can have a clean env
46    TCtmp="/home/$TEST_USER"
47
48    tst_setup
49
50    exists expect ftp ftp02_s1 useradd userdel
51    
52    userdel $TEST_USER 
53    sleep 1
54
55    if ! useradd -m -p $TEST_USER_ENCRYPTED_PASSWD $TEST_USER; then
56        end_testcase "Could not add test user $TEST_USER to system $RHOST."
57    fi
58
59    trap do_cleanup EXIT
60
61}
62
63#-----------------------------------------------------------------------
64# FUNCTION:  do_cleanup
65#-----------------------------------------------------------------------
66
67do_cleanup()
68{
69    userdel $TEST_USER
70    tst_cleanup
71}
72
73#-----------------------------------------------------------------------
74# FUNCTION:  MAIN
75#
76# DESCRIPTION: Create Test User
77#              Call upon script to make sure test user cannont log in with invalid password
78#	       Cleanup Test User from system
79#              Exit with exit code of script called upon
80#-----------------------------------------------------------------------
81. net_cmdlib.sh
82
83read_opts $*
84do_setup
85ftp02_s1 || end_testcase "Testcase failed."
86end_testcase
87