File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ run_test "sshd_exec_test.sh"
6161run_test " sshd_term_size_test.sh"
6262run_test " sshd_large_sftp_test.sh"
6363run_test " sshd_bad_sftp_test.sh"
64+ run_test " sshd_term_close_test.sh"
6465
6566# Github actions needs resolved for these test cases
6667# run_test "error_return.sh"
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # sshd local test
4+
5+ ROOT_PWD=$( pwd)
6+ cd ../../..
7+
8+ TEST_CLIENT=" ./examples/client/client"
9+ PRIVATE_KEY=" ./keys/hansel-key-ecc.der"
10+ PUBLIC_KEY=" ./keys/hansel-key-ecc.pub"
11+
12+ if [ -z " $1 " ] || [ -z " $2 " ] || [ -z " $3 " ]; then
13+ echo " expecting host and port as arguments"
14+ echo " $0 127.0.0.1 22222 $USER "
15+ exit 1
16+ fi
17+
18+ # get the current wolfsshd pid count to compare with
19+ WOLFSSHD_PID_COUNT=$( pgrep wolfsshd | wc -l)
20+
21+ timeout 3 $TEST_CLIENT -p $2 -i $PRIVATE_KEY -j $PUBLIC_KEY -h $1 -c ' /bin/sleep 10' -u $3 &
22+ sleep 1
23+ WOLFSSHD_PID_COUNT_AFTER=$( pgrep wolfsshd | wc -l)
24+ if [ " $WOLFSSHD_PID_COUNT " = " $WOLFSSHD_PID_COUNT_AFTER " ]; then
25+ echo " Expecting another wolfSSHd pid after connection"
26+ echo " PID count before = $WOLFSSHD_PID_COUNT "
27+ echo " PID count after = $WOLFSSHD_PID_COUNT_AFTER "
28+ exit 1
29+ fi
30+
31+ netstat -nt | grep ESTABLISHED
32+ RESULT=$?
33+ if [ " $RESULT " != " 0" ]; then
34+ echo " Expecting to find the TCP connection established"
35+ exit 1
36+ fi
37+
38+ sleep 2
39+
40+ netstat -nt | grep CLOSE_WAIT
41+ RESULT=$?
42+ if [ " $RESULT " = " 0" ]; then
43+ echo " Found close wait and was not expecting it"
44+ exit 1
45+ fi
46+
47+ netstat -nt | grep TIME_WAIT
48+ RESULT=$?
49+ if [ " $RESULT " != " 0" ]; then
50+ echo " Did not find timed wait for TCP close down"
51+ exit 1
52+ fi
53+
54+ cd " $ROOT_PWD "
55+ exit 0
56+
57+
You can’t perform that action at this time.
0 commit comments