djm@openbsd.org | 1de5e47 | 2017-06-07 01:48:15 +0000 | [diff] [blame^] | 1 | # $OpenBSD: proto-version.sh,v 1.7 2017/06/07 01:48:15 djm Exp $ |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 2 | # Placed in the Public Domain. |
| 3 | |
| 4 | tid="sshd version with different protocol combinations" |
| 5 | |
| 6 | # we just start sshd in inetd mode and check the banner |
| 7 | check_version () |
| 8 | { |
djm@openbsd.org | 1de5e47 | 2017-06-07 01:48:15 +0000 | [diff] [blame^] | 9 | expect=$1 |
djm@openbsd.org | dd36932 | 2017-04-30 23:34:55 +0000 | [diff] [blame] | 10 | banner=`printf '' | ${SSHD} -i -f ${OBJ}/sshd_proxy` |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 11 | case ${banner} in |
| 12 | SSH-1.99-*) |
| 13 | proto=199 |
| 14 | ;; |
| 15 | SSH-2.0-*) |
| 16 | proto=20 |
| 17 | ;; |
| 18 | SSH-1.5-*) |
| 19 | proto=15 |
| 20 | ;; |
| 21 | *) |
| 22 | proto=0 |
| 23 | ;; |
| 24 | esac |
| 25 | if [ ${expect} -ne ${proto} ]; then |
djm@openbsd.org | dd36932 | 2017-04-30 23:34:55 +0000 | [diff] [blame] | 26 | fail "wrong protocol version ${banner}" |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 27 | fi |
| 28 | } |
| 29 | |
djm@openbsd.org | dd36932 | 2017-04-30 23:34:55 +0000 | [diff] [blame] | 30 | check_version 20 |