diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2007-06-07 19:49:09 +0000 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2007-06-07 19:49:09 +0000 |
commit | f0ffb35d5517c69c6df5777c070aa83a4602f073 (patch) | |
tree | 97bd1fd7a5a980d2505f9f033abea0141b20fe04 | |
parent | b4d2fbae6de39a1b61618c52f332a1a4492161a3 (diff) |
Fixed some problems in starting SSH for use in SOCKS.
-rwxr-xr-x | tests/runtests.pl | 15 | ||||
-rw-r--r-- | tests/sshserver.pl | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl index 7d1bd1df3..36ed610fd 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -292,12 +292,16 @@ sub startnew { # Ugly hack but ssh doesn't support pid files if ($fake) { - logmsg "$pidfile faked with pid=$child\n"; + logmsg "$pidfile faked with pid=$child\n" if($verbose); open(my $OUT, ">", $pidfile); print $OUT $child; close $OUT; # could/should do a while connect fails sleep a bit and loop sleep 1; + if (checkdied($child)) { + logmsg "startnew: Warning: child process has failed to start\n" if($verbose); + return (-1,-1); + } } my $count=12; while($count--) { @@ -451,7 +455,7 @@ sub torture { sub stopserver { my ($pid) = @_; - if(not defined $pid) { + if(not defined $pid || $pid <= 0) { return; # whad'da'ya wanna'da with no pid ? } @@ -991,7 +995,7 @@ sub runsocksserver { my ($sshpid, $pid2) = startnew($cmd, $pidfile,1); # start the server in a new process - if(!$sshpid || !kill(0, $sshpid)) { + if($sshpid <= 0 || !kill(0, $sshpid)) { # it is NOT alive logmsg "RUN: failed to start the SOCKS server\n"; # failed to talk to it properly. Kill the server and return failure @@ -2266,10 +2270,11 @@ sub startservers { if ($sshversion =~ /SSH_(\d+)\.(\d+)/i) { if ($1*10+$2 < 37) { # need 3.7 for socks5 - http://www.openssh.com/txt/release-3.7 - return "ssh version ($1.$2) $sshversion insufficient need at least 3.7\n" if ($verbose); + return "ssh version ($1.$2) insufficient; need at least 3.7"; } + } else { + return "Unsupported ssh client\n"; } - } if(!$run{'socks'}) { ($pid, $pid2) = runsocksserver("", $verbose); diff --git a/tests/sshserver.pl b/tests/sshserver.pl index e24352023..e650e2893 100644 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -108,7 +108,7 @@ if ($verbose) { # 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"; + print "SCP, SFTP and SOCKS tests require OpenSSH 3.7 or later\n"; exit 1; } |