# $OpenBSD: proto-version.sh,v 1.5 2015/03/03 22:35:19 markus Exp $ # Placed in the Public Domain. setglobal tid = '"sshd version with different protocol combinations'" # we just start sshd in inetd mode and check the banner proc check_version { setglobal version = $1 setglobal expect = $2 setglobal banner = $[printf '' | $(SSHD) -o "Protocol=$(version)" -i -f $(OBJ)/sshd_proxy] match $(banner) { with SSH-1.99-* setglobal proto = '199' with SSH-2.0-* setglobal proto = '20' with SSH-1.5-* setglobal proto = '15' with * setglobal proto = '0' } if test $(expect) -ne $(proto) { fail "wrong protocol version $(banner) for $(version)" } } check_version 2 20 if ssh_version 1 { check_version 2,1 199 check_version 1,2 199 check_version 1 15 }