From bdbaedc45222c0de88c40d8fd9dff98ada85ac3d Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 2 Apr 2007 01:21:57 +0000 Subject: verify ssh daemon version --- tests/sshserver.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/sshserver.pl b/tests/sshserver.pl index a00dbbcd8..fefe1b557 100644 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -86,6 +86,30 @@ if ($username eq "root") { exit 1; } +# Find out sshd version. +my $tmpstr; +my $ssh_daemon; +my $ssh_ver_major; +my $ssh_ver_minor; +my $ssh_ver_patch; +chomp($tmpstr = qx($sshd -V 2>&1 | grep OpenSSH)); +if ($tmpstr =~ /OpenSSH[_-](\d+)\.(\d+)(\.(\d+))*/) { + ($ssh_ver_major, $ssh_ver_minor, $ssh_ver_patch) = ($1, $2, $4); + $ssh_daemon = 'OpenSSH'; +} +if ($verbose) { + print STDERR "ssh_daemon: $ssh_daemon\n"; + print STDERR "ssh_ver_major: $ssh_ver_major\n"; + print STDERR "ssh_ver_minor: $ssh_ver_minor\n"; + print STDERR "ssh_ver_patch: $ssh_ver_patch\n"; +} + +# Verify minimum OpenSSH version. +if ($ssh_daemon !~ /OpenSSH/) || (10 * $ssh_ver_major + $ssh_ver_minor < 37) + print "SCP and SFTP tests require OpenSSH 3.7 or later\n"; + exit 1; +} + # Support for some options might have not been built into sshd. On some # platforms specifying an unsupported option prevents sshd from starting. # Check here for possible unsupported options, avoiding its use in sshd. -- cgit v1.2.3