xref: /openssh-portable/regress/portnum.sh (revision 0a404b0e)
1#	$OpenBSD: portnum.sh,v 1.2 2013/05/17 10:34:30 dtucker Exp $
2#	Placed in the Public Domain.
3
4tid="port number parsing"
5
6badport() {
7	port=$1
8	verbose "$tid: invalid port $port"
9	if ${SSH} -F $OBJ/ssh_proxy -p $port somehost true 2>/dev/null ; then
10		fail "$tid accepted invalid port $port"
11	fi
12}
13goodport() {
14	port=$1
15	verbose "$tid: valid port $port"
16	if ${SSH} -F $OBJ/ssh_proxy -p $port somehost true 2>/dev/null ; then
17		:
18	else
19		fail "$tid rejected valid port $port"
20	fi
21}
22
23badport 0
24badport 65536
25badport 131073
26badport 2000blah
27badport blah2000
28
29goodport 1
30goodport 22
31goodport 2222
32goodport 22222
33goodport 65535
34
35