2 #*********************************************************************
3 # Copyright (c) International Business Machines Corp., 2000
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.
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.
15 # You should have received a copy of the GNU General Public License
16 # along with this pronram; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # PURPOSE: Tests to see that ssh rejects an invalid username
23 # SETUP: The program `/usr/bin/expect' MUST be installed.
26 # 03/03 Jerone Young (jeroney@us.ibm.com)
29 #-----------------------------------------------------------------------
31 #-----------------------------------------------------------------------
36 export RHOST
="localhost"
37 export TEST_USER
="ssh_usr2"
38 export TEST_USER_PASSWD
="now_this_is_a_good_ltp_test_password"
39 export TEST_USER_ENCRYPTED_PASSWD
="42VmxaOByKwlA"
40 export TEST_USER_HOMEDIR
="/home/$TEST_USER"
42 # erase user if he/she already exists, so we can have a clean env
43 TCtmp
=/home
/$TEST_USER
49 exists expect
ssh ssh02_s1 useradd userdel
54 if ! useradd
-m -p $TEST_USER_ENCRYPTED_PASSWD $TEST_USER; then
55 end_testcase
"Could not add test user $TEST_USER to system $RHOST."
58 # create users home diretory (SLES 8 does not do this, even when specified
60 USER_UID
=$
(id
-u $TEST_USER)
61 USER_GID
=$
(id
-g $TEST_USER)
62 if ! mkdir
"$TEST_USER_HOMEDIR"; then
63 end_testcase
"Failed to create $TEST_USER_HOMEDIR"
65 chown
-R $USER_UID.
$USER_GID "$TEST_USER_HOMEDIR"
71 #-----------------------------------------------------------------------
72 # FUNCTION: do_cleanup
73 #-----------------------------------------------------------------------
81 #-----------------------------------------------------------------------
84 # DESCRIPTION: Create Test User
85 # Call upon script to make sure an invalid user can not have access
86 # Cleanup Test User from system
87 # Exit with exit code of script called upon
88 #-----------------------------------------------------------------------
93 ssh02_s1 || end_testcase
"Testcase failed"