verify ssh daemon version

This commit is contained in:
Yang Tse 2007-04-02 01:21:57 +00:00
parent 0839621f47
commit bdbaedc452
1 changed files with 24 additions and 0 deletions

View File

@ -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.