Skip to content

Commit

Permalink
secureserver.pl: update Windows detection and fix path conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
mback2k committed Dec 19, 2014
1 parent 3b7bf29 commit 6a76d3e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/secureserver.pl
Expand Up @@ -53,6 +53,7 @@ BEGIN
my $ver_minor;
my $fips_support;
my $stunnel_version;
my $tstunnel_windows;
my $socketopt;
my $cmd;

Expand Down Expand Up @@ -222,6 +223,17 @@ sub exit_signal_handler {
exit 1;
}

#***************************************************************************
# Find out if we are running on Windows using the tstunnel binary
#
if($stunnel =~ /tstunnel(\.exe)?"?$/) {
$tstunnel_windows = 1;

# replace Cygwin and MinGW drives within paths
$capath =~ s/^(\/cygdrive)?\/(\w)\//$2\:\//;
$certfile =~ s/^(\/cygdrive)?\/(\w)\//$2\:\//;
}

#***************************************************************************
# Build command to execute for stunnel 3.X versions
#
Expand Down Expand Up @@ -267,7 +279,7 @@ sub exit_signal_handler {
print STUNCONF "
fips = no";
}
if($stunnel !~ /tstunnel(\.exe)?"?$/) {
if(!$tstunnel_windows) {
print STUNCONF "
output = $logfile
pid = $pidfile
Expand Down Expand Up @@ -311,7 +323,7 @@ sub exit_signal_handler {
#***************************************************************************
# Run tstunnel on Windows.
#
if($stunnel =~ /tstunnel(\.exe)?"?$/) {
if($tstunnel_windows) {
# Fake pidfile for tstunnel on Windows.
if(open(OUT, ">$pidfile")) {
print OUT $$ . "\n";
Expand Down

0 comments on commit 6a76d3e

Please sign in to comment.