summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2009-08-13 00:57:18 +0000
committerDamien Miller <djm@cvs.openbsd.org>2009-08-13 00:57:18 +0000
commite7e0830d6f6e58fc5bd99e25425cbdfc3422732c (patch)
tree7a992f8ae7a1782ab25b67cba3104fa4e4403170 /regress/usr.bin
parentcde721b90ddf3a3a2a74895d41196b831708cec1 (diff)
regression test for port number parsing. written as part of the a2port
change that went into 5.2 but I forgot to commit it at the time...
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/ssh/Makefile5
-rw-r--r--regress/usr.bin/ssh/portnum.sh32
2 files changed, 35 insertions, 2 deletions
diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile
index 3ade8c907f7..c2dcc7a45e3 100644
--- a/regress/usr.bin/ssh/Makefile
+++ b/regress/usr.bin/ssh/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.48 2008/06/28 13:57:25 djm Exp $
+# $OpenBSD: Makefile,v 1.49 2009/08/13 00:57:17 djm Exp $
REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7
@@ -42,7 +42,8 @@ LTESTS= connect \
cfgmatch \
addrmatch \
localcommand \
- forcecommand
+ forcecommand \
+ portnum
INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
diff --git a/regress/usr.bin/ssh/portnum.sh b/regress/usr.bin/ssh/portnum.sh
new file mode 100644
index 00000000000..82abbc9f0d6
--- /dev/null
+++ b/regress/usr.bin/ssh/portnum.sh
@@ -0,0 +1,32 @@
+# $OpenBSD: portnum.sh,v 1.1 2009/08/13 00:57:17 djm Exp $
+# Placed in the Public Domain.
+
+tid="port number parsing"
+
+badport() {
+ port=$1
+ verbose "$tid: invalid port $port"
+ if ${SSH} -F $OBJ/ssh_proxy -p $port somehost true 2>/dev/null ; then
+ fail "$tid accepted invalid port $port"
+ fi
+}
+goodport() {
+ port=$1
+ verbose "$tid: valid port $port"
+ if ! ${SSH} -F $OBJ/ssh_proxy -p $port somehost true 2>/dev/null ; then
+ fail "$tid rejected valid port $port"
+ fi
+}
+
+badport 0
+badport 65536
+badport 131073
+badport 2000blah
+badport blah2000
+
+goodport 1
+goodport 22
+goodport 2222
+goodport 22222
+goodport 65535
+