1 # $OpenBSD: portnum.sh,v 1.1 2009/08/13 00:57:17 djm Exp $ 2 # Placed in the Public Domain. 3 4 tid="port number parsing" 5 6 badport() { 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 } 13 goodport() { 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 23 badport 0 24 badport 65536 25 badport 131073 26 badport 2000blah 27 badport blah2000 28 29 goodport 1 30 goodport 22 31 goodport 2222 32 goodport 22222 33 goodport 65535 34 35