proto-version.sh 539 B

12345678910111213141516171819202122232425262728293031
  1. # $OpenBSD: proto-version.sh,v 1.7 2017/06/07 01:48:15 djm Exp $
  2. # Placed in the Public Domain.
  3. tid="sshd version with different protocol combinations"
  4. # we just start sshd in inetd mode and check the banner
  5. check_version()
  6. {
  7. expect=$1
  8. banner=$(printf '' | ${SSHD} -i -f ${OBJ}/sshd_proxy)
  9. case ${banner} in
  10. SSH-1.99-*)
  11. proto=199
  12. ;;
  13. SSH-2.0-*)
  14. proto=20
  15. ;;
  16. SSH-1.5-*)
  17. proto=15
  18. ;;
  19. *)
  20. proto=0
  21. ;;
  22. esac
  23. if [ ${expect} -ne ${proto} ]; then
  24. fail "wrong protocol version ${banner}"
  25. fi
  26. }
  27. check_version 20