aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-04-02 01:21:57 +0000
committerYang Tse <yangsita@gmail.com>2007-04-02 01:21:57 +0000
commitbdbaedc45222c0de88c40d8fd9dff98ada85ac3d (patch)
tree428738220d6401fb5de30ff6d4a410ad6b205143
parent0839621f47e0a43b547009bf57595daf359388c2 (diff)
verify ssh daemon version
-rw-r--r--tests/sshserver.pl24
1 files changed, 24 insertions, 0 deletions
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.