blob: c56b869a31bd08e26b686e2ef02b90c90e1e9e2b [file] [log] [blame]
Darren Tucker0a404b02013-05-17 20:47:29 +10001# $OpenBSD: portnum.sh,v 1.2 2013/05/17 10:34:30 dtucker Exp $
Darren Tuckera25ab012009-10-07 11:00:58 +11002# 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"
Tim Rice999aaf42010-01-16 11:37:53 -080016 if ${SSH} -F $OBJ/ssh_proxy -p $port somehost true 2>/dev/null ; then
17 :
18 else
Darren Tuckera25ab012009-10-07 11:00:58 +110019 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