markus@openbsd.org | dad2b18 | 2015-03-03 22:35:19 +0000 | [diff] [blame] | 1 | # $OpenBSD: proto-version.sh,v 1.5 2015/03/03 22:35:19 markus 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 | { |
| 9 | version=$1 |
| 10 | expect=$2 |
Darren Tucker | 56347ef | 2013-05-17 13:28:36 +1000 | [diff] [blame] | 11 | banner=`printf '' | ${SSHD} -o "Protocol=${version}" -i -f ${OBJ}/sshd_proxy` |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 12 | case ${banner} in |
| 13 | SSH-1.99-*) |
| 14 | proto=199 |
| 15 | ;; |
| 16 | SSH-2.0-*) |
| 17 | proto=20 |
| 18 | ;; |
| 19 | SSH-1.5-*) |
| 20 | proto=15 |
| 21 | ;; |
| 22 | *) |
| 23 | proto=0 |
| 24 | ;; |
| 25 | esac |
| 26 | if [ ${expect} -ne ${proto} ]; then |
| 27 | fail "wrong protocol version ${banner} for ${version}" |
| 28 | fi |
| 29 | } |
| 30 | |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 31 | check_version 2 20 |
markus@openbsd.org | dad2b18 | 2015-03-03 22:35:19 +0000 | [diff] [blame] | 32 | if ssh_version 1; then |
| 33 | check_version 2,1 199 |
| 34 | check_version 1,2 199 |
| 35 | check_version 1 15 |
| 36 | fi |