mirror of https://github.com/moparisthebest/curl
Improve detection of sshd un/supported options.
Gather additional debug info when the test suite ssh server fails to start.
This commit is contained in:
parent
600d0b1303
commit
258c4686b2
|
@ -61,6 +61,19 @@ sub searchpath {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Display contents of the given file.
|
||||||
|
sub displayfile {
|
||||||
|
my ($file) = @_;
|
||||||
|
print "=== Start of file $file\n";
|
||||||
|
if(open(SINGLE, "<$file")) {
|
||||||
|
while(my $string = <SINGLE>) {
|
||||||
|
print "$string";
|
||||||
|
}
|
||||||
|
close(SINGLE);
|
||||||
|
}
|
||||||
|
print "=== End of file $file\n";
|
||||||
|
}
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
do {
|
do {
|
||||||
if($ARGV[0] eq "-v") {
|
if($ARGV[0] eq "-v") {
|
||||||
|
@ -170,7 +183,8 @@ close CONF;
|
||||||
# Check here for possible unsupported options, avoiding its use in sshd.
|
# Check here for possible unsupported options, avoiding its use in sshd.
|
||||||
sub sshd_supports_opt($) {
|
sub sshd_supports_opt($) {
|
||||||
my ($option) = @_;
|
my ($option) = @_;
|
||||||
my $err = grep /Unsupported .* $option/, qx($sshd -t -f $conffile -o $option=no 2>&1);
|
my $err = grep /((Unsupported)|(Bad configuration)|(Deprecated)) option.*$option/,
|
||||||
|
qx($sshd -t -f $conffile -o $option=no 2>&1);
|
||||||
return !$err;
|
return !$err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,9 +292,13 @@ EOFSSH
|
||||||
close SSHFILE || die "Could not close $conffile_ssh";
|
close SSHFILE || die "Could not close $conffile_ssh";
|
||||||
|
|
||||||
|
|
||||||
if (system "$sshd -t -q -f $conffile") {
|
# Verify that sshd supports our configuration file
|
||||||
|
if (system "$sshd -t -f $conffile > log/sshd.log 2>&1") {
|
||||||
# This is likely due to missing support for UsePam
|
# This is likely due to missing support for UsePam
|
||||||
print "$sshd is too old and is not supported\n";
|
print "$sshd is too old and is not supported\n";
|
||||||
|
displayfile("log/sshd.log");
|
||||||
|
displayfile("$conffile");
|
||||||
|
unlink "log/sshd.log";
|
||||||
unlink $conffile;
|
unlink $conffile;
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
@ -291,6 +309,11 @@ $rc >>= 8;
|
||||||
if($rc && $verbose) {
|
if($rc && $verbose) {
|
||||||
print STDERR "$sshd exited with $rc!\n";
|
print STDERR "$sshd exited with $rc!\n";
|
||||||
}
|
}
|
||||||
|
if($rc) {
|
||||||
|
print "$sshd exited with $rc!\n";
|
||||||
|
displayfile("log/sshd.log");
|
||||||
|
displayfile("$conffile");
|
||||||
|
}
|
||||||
|
|
||||||
unlink $conffile;
|
unlink $conffile;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue