diff options
author | Marc Hoersken <info@marc-hoersken.de> | 2014-12-21 03:48:41 +0100 |
---|---|---|
committer | Marc Hoersken <info@marc-hoersken.de> | 2014-12-21 03:52:37 +0100 |
commit | ed68159d191b0b1e83a0282baa643d1135a970da (patch) | |
tree | 9b30eacc60c933289b39150fd309c53800f44ba9 | |
parent | 011488945600f6ddc53d2a8d2c6c3c1122e8d7fb (diff) |
tests: use Cygwin-style paths in SSH, SSHD and SFTP config files
Second patch to enable Windows support using Cygwin-based OpenSSH.
Tested with CopSSH 5.0.0 free edition using an msys shell on Windows 7.
-rwxr-xr-x | tests/sshserver.pl | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/tests/sshserver.pl b/tests/sshserver.pl index 794cadcdd..f167f0a21 100755 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -27,6 +27,7 @@ use strict; use warnings; use Cwd; +use Cwd 'abs_path'; #*************************************************************************** # Variables and subs imported from sshhelp module @@ -382,6 +383,22 @@ if((! -e $hstprvkeyf) || (! -s $hstprvkeyf) || #*************************************************************************** +# Convert paths for curl's tests running on Windows using Cygwin OpenSSH +# +my $clipubkeyf_config = abs_path("$path/$clipubkeyf"); +my $hstprvkeyf_config = abs_path("$path/$hstprvkeyf"); +my $pidfile_config = $pidfile; +my $sftpsrv_config = $sftpsrv; + +if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys') { + # convert MinGW drive paths to Cygwin drive paths + $clipubkeyf_config =~ s/^\/(\w)\//\/cygdrive\/$1\//; + $hstprvkeyf_config =~ s/^\/(\w)\//\/cygdrive\/$1\//; + $pidfile_config =~ s/^\/(\w)\//\/cygdrive\/$1\//; + $sftpsrv_config = "internal-sftp"; +} + +#*************************************************************************** # ssh daemon configuration file options we might use and version support # # AFSTokenPassing : OpenSSH 1.2.1 and later [1] @@ -479,10 +496,10 @@ push @cfgarr, "AllowUsers $username"; push @cfgarr, 'DenyGroups'; push @cfgarr, 'AllowGroups'; push @cfgarr, '#'; -push @cfgarr, "AuthorizedKeysFile $path/$clipubkeyf"; -push @cfgarr, "AuthorizedKeysFile2 $path/$clipubkeyf"; -push @cfgarr, "HostKey $path/$hstprvkeyf"; -push @cfgarr, "PidFile $pidfile"; +push @cfgarr, "AuthorizedKeysFile $clipubkeyf_config"; +push @cfgarr, "AuthorizedKeysFile2 $clipubkeyf_config"; +push @cfgarr, "HostKey $hstprvkeyf_config"; +push @cfgarr, "PidFile $pidfile_config"; push @cfgarr, '#'; push @cfgarr, "Port $port"; push @cfgarr, "ListenAddress $listenaddr"; @@ -512,7 +529,7 @@ push @cfgarr, 'RhostsRSAAuthentication no'; push @cfgarr, 'RSAAuthentication no'; push @cfgarr, 'ServerKeyBits 768'; push @cfgarr, 'StrictModes no'; -push @cfgarr, "Subsystem sftp \"$sftpsrv\""; +push @cfgarr, "Subsystem sftp \"$sftpsrv_config\""; push @cfgarr, 'SyslogFacility AUTH'; push @cfgarr, 'UseLogin no'; push @cfgarr, 'X11Forwarding no'; @@ -739,6 +756,19 @@ if((! -e $knownhosts) || (! -s $knownhosts)) { #*************************************************************************** +# Convert paths for curl's tests running on Windows using Cygwin OpenSSH +# +my $identityf = abs_path("$path/curl_client_key"); +my $knownhostsf = abs_path("$path/$knownhosts"); + +if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys') { + # convert MinGW drive paths to Cygwin drive paths + $identityf =~ s/^\/(\w)\//\/cygdrive\/$1\//; + $knownhostsf =~ s/^\/(\w)\//\/cygdrive\/$1\//; +} + + +#*************************************************************************** # ssh client configuration file options we might use and version support # # AddressFamily : OpenSSH 3.7.0 and later @@ -834,8 +864,8 @@ push @cfgarr, '#'; push @cfgarr, "BindAddress $listenaddr"; push @cfgarr, "DynamicForward $socksport"; push @cfgarr, '#'; -push @cfgarr, "IdentityFile $path/curl_client_key"; -push @cfgarr, "UserKnownHostsFile $path/$knownhosts"; +push @cfgarr, "IdentityFile $identityf"; +push @cfgarr, "UserKnownHostsFile $knownhostsf"; push @cfgarr, '#'; push @cfgarr, 'BatchMode yes'; push @cfgarr, 'ChallengeResponseAuthentication no'; |