tests: move pidfiles and portfiles under the log directory
This is to segregate all files written by a test process into a single root to allow for future parallel testing. Ref: #10818 Closes #10874
This commit is contained in:
parent
ec2a5bc5fc
commit
3cc41a2d36
10
tests/ftp.pm
10
tests/ftp.pm
@ -322,7 +322,7 @@ sub killpid {
|
||||
# killsockfilters kills sockfilter processes for a given server.
|
||||
#
|
||||
sub killsockfilters {
|
||||
my ($proto, $ipvnum, $idnum, $verbose, $which) = @_;
|
||||
my ($piddir, $proto, $ipvnum, $idnum, $verbose, $which) = @_;
|
||||
my $server;
|
||||
my $pidfile;
|
||||
my $pid;
|
||||
@ -335,7 +335,7 @@ sub killsockfilters {
|
||||
$server = servername_id($proto, $ipvnum, $idnum) if($verbose);
|
||||
|
||||
if(!$which || ($which eq 'main')) {
|
||||
$pidfile = mainsockf_pidfilename($proto, $ipvnum, $idnum);
|
||||
$pidfile = mainsockf_pidfilename($piddir, $proto, $ipvnum, $idnum);
|
||||
$pid = processexists($pidfile);
|
||||
if($pid > 0) {
|
||||
printf("* kill pid for %s-%s => %d\n", $server,
|
||||
@ -349,7 +349,7 @@ sub killsockfilters {
|
||||
return if($proto ne 'ftp');
|
||||
|
||||
if(!$which || ($which eq 'data')) {
|
||||
$pidfile = datasockf_pidfilename($proto, $ipvnum, $idnum);
|
||||
$pidfile = datasockf_pidfilename($piddir, $proto, $ipvnum, $idnum);
|
||||
$pid = processexists($pidfile);
|
||||
if($pid > 0) {
|
||||
printf("* kill pid for %s-data => %d\n", $server,
|
||||
@ -365,12 +365,12 @@ sub killsockfilters {
|
||||
# killallsockfilters kills sockfilter processes for all servers.
|
||||
#
|
||||
sub killallsockfilters {
|
||||
my $verbose = $_[0];
|
||||
my ($piddir, $verbose) = @_;
|
||||
|
||||
for my $proto (('ftp', 'imap', 'pop3', 'smtp')) {
|
||||
for my $ipvnum (('4', '6')) {
|
||||
for my $idnum (('1', '2')) {
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose);
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,9 @@
|
||||
# All socket/network/TCP related stuff is done by the 'sockfilt' program.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
BEGIN {
|
||||
push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
|
||||
push(@INC, ".");
|
||||
@ -51,10 +54,9 @@ BEGIN {
|
||||
}
|
||||
}
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use IPC::Open2;
|
||||
use Digest::MD5;
|
||||
use File::Basename;
|
||||
|
||||
require "getpart.pm";
|
||||
require "ftp.pm";
|
||||
@ -88,6 +90,7 @@ my $cwd_testno; # test case numbers extracted from CWD command
|
||||
my $testno = 0; # test case number (read from ftpserver.cmd)
|
||||
my $path = '.';
|
||||
my $logdir = $path .'/log';
|
||||
my $piddir;
|
||||
|
||||
#**********************************************************************
|
||||
# global vars used for server address and primary listener port
|
||||
@ -98,8 +101,9 @@ my $listenaddr = '127.0.0.1'; # default address for listener port
|
||||
#**********************************************************************
|
||||
# global vars used for file names
|
||||
#
|
||||
my $PORTFILE="ftpserver.port"; # server port file name
|
||||
my $portfile; # server port file path
|
||||
my $pidfile; # server pid file name
|
||||
my $portfile=".ftpserver.port"; # server port file name
|
||||
my $logfile; # server log file name
|
||||
my $mainsockf_pidfile; # pid file for primary connection sockfilt process
|
||||
my $mainsockf_logfile; # log file for primary connection sockfilt process
|
||||
@ -197,7 +201,7 @@ my $POP3_TIMESTAMP = "<1972.987654321\@curl>";
|
||||
sub exit_signal_handler {
|
||||
my $signame = shift;
|
||||
# For now, simply mimic old behavior.
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose);
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose);
|
||||
unlink($pidfile);
|
||||
unlink($portfile);
|
||||
if($serverlogslocked) {
|
||||
@ -397,7 +401,7 @@ sub sysread_or_die {
|
||||
logmsg "Error: $srvrname server, sysread error: $!\n";
|
||||
logmsg "Exited from sysread_or_die() at $fcaller " .
|
||||
"line $lcaller. $srvrname server, sysread error: $!\n";
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose);
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose);
|
||||
unlink($pidfile);
|
||||
unlink($portfile);
|
||||
if($serverlogslocked) {
|
||||
@ -412,7 +416,7 @@ sub sysread_or_die {
|
||||
logmsg "Error: $srvrname server, read zero\n";
|
||||
logmsg "Exited from sysread_or_die() at $fcaller " .
|
||||
"line $lcaller. $srvrname server, read zero\n";
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose);
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose);
|
||||
unlink($pidfile);
|
||||
unlink($portfile);
|
||||
if($serverlogslocked) {
|
||||
@ -441,7 +445,7 @@ sub startsf {
|
||||
|
||||
if($pong !~ /^PONG/) {
|
||||
logmsg "Failed sockfilt command: $mainsockfcmd\n";
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose);
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose);
|
||||
unlink($pidfile);
|
||||
unlink($portfile);
|
||||
if($serverlogslocked) {
|
||||
@ -2453,7 +2457,7 @@ sub PASV_ftp {
|
||||
|
||||
# kill previous data connection sockfilt when alive
|
||||
if($datasockf_runs eq 'yes') {
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
logmsg "DATA sockfilt for $datasockf_mode data channel killed\n";
|
||||
}
|
||||
datasockf_state('STOPPED');
|
||||
@ -2494,7 +2498,7 @@ sub PASV_ftp {
|
||||
logmsg "DATA sockfilt unexpected response: $pong\n";
|
||||
logmsg "DATA sockfilt for passive data channel failed\n";
|
||||
logmsg "DATA sockfilt killed now\n";
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
logmsg "DATA sockfilt not running\n";
|
||||
datasockf_state('STOPPED');
|
||||
sendcontrol "500 no free ports!\r\n";
|
||||
@ -2533,7 +2537,7 @@ sub PASV_ftp {
|
||||
logmsg "DATA sockfilt unknown listener port\n";
|
||||
logmsg "DATA sockfilt for passive data channel failed\n";
|
||||
logmsg "DATA sockfilt killed now\n";
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
logmsg "DATA sockfilt not running\n";
|
||||
datasockf_state('STOPPED');
|
||||
sendcontrol "500 no free ports!\r\n";
|
||||
@ -2603,7 +2607,7 @@ sub PASV_ftp {
|
||||
"on port $pasvport\n";
|
||||
logmsg "accept failed or connection not even attempted\n";
|
||||
logmsg "DATA sockfilt killed now\n";
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
logmsg "DATA sockfilt not running\n";
|
||||
datasockf_state('STOPPED');
|
||||
return;
|
||||
@ -2627,7 +2631,7 @@ sub PORT_ftp {
|
||||
|
||||
# kill previous data connection sockfilt when alive
|
||||
if($datasockf_runs eq 'yes') {
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
logmsg "DATA sockfilt for $datasockf_mode data channel killed\n";
|
||||
}
|
||||
datasockf_state('STOPPED');
|
||||
@ -2708,7 +2712,7 @@ sub PORT_ftp {
|
||||
logmsg "DATA sockfilt unexpected response: $pong\n";
|
||||
logmsg "DATA sockfilt for active data channel failed\n";
|
||||
logmsg "DATA sockfilt killed now\n";
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
logmsg "DATA sockfilt not running\n";
|
||||
datasockf_state('STOPPED');
|
||||
# client shall timeout awaiting connection from server
|
||||
@ -3038,25 +3042,32 @@ while(@ARGV) {
|
||||
# Initialize command line option dependent variables
|
||||
#
|
||||
|
||||
if($pidfile) {
|
||||
# Use our pidfile directory to store the other pidfiles
|
||||
$piddir = dirname($pidfile);
|
||||
}
|
||||
else {
|
||||
# Use the current directory to store all the pidfiles
|
||||
$piddir = $path;
|
||||
$pidfile = server_pidfilename($piddir, $proto, $ipvnum, $idnum);
|
||||
}
|
||||
if(!$portfile) {
|
||||
$portfile = $piddir . "/" . $PORTFILE;
|
||||
}
|
||||
if(!$srcdir) {
|
||||
$srcdir = $ENV{'srcdir'} || '.';
|
||||
}
|
||||
if(!$pidfile) {
|
||||
$pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
|
||||
}
|
||||
if(!$logfile) {
|
||||
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
|
||||
}
|
||||
|
||||
$mainsockf_pidfile = "$path/".
|
||||
mainsockf_pidfilename($proto, $ipvnum, $idnum);
|
||||
$mainsockf_pidfile = mainsockf_pidfilename($piddir, $proto, $ipvnum, $idnum);
|
||||
$mainsockf_logfile =
|
||||
mainsockf_logfilename($logdir, $proto, $ipvnum, $idnum);
|
||||
$serverlogs_lockfile = "$logdir/$SERVERLOGS_LOCK";
|
||||
|
||||
if($proto eq 'ftp') {
|
||||
$datasockf_pidfile = "$path/".
|
||||
datasockf_pidfilename($proto, $ipvnum, $idnum);
|
||||
$datasockf_pidfile = datasockf_pidfilename($piddir, $proto, $ipvnum, $idnum);
|
||||
$datasockf_logfile =
|
||||
datasockf_logfilename($logdir, $proto, $ipvnum, $idnum);
|
||||
}
|
||||
@ -3093,7 +3104,7 @@ while(1) {
|
||||
|
||||
# kill previous data connection sockfilt when alive
|
||||
if($datasockf_runs eq 'yes') {
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose, 'data');
|
||||
logmsg "DATA sockfilt for $datasockf_mode data channel killed now\n";
|
||||
}
|
||||
datasockf_state('STOPPED');
|
||||
@ -3340,7 +3351,7 @@ while(1) {
|
||||
}
|
||||
}
|
||||
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose);
|
||||
killsockfilters($piddir, $proto, $ipvnum, $idnum, $verbose);
|
||||
unlink($pidfile);
|
||||
if($serverlogslocked) {
|
||||
$serverlogslocked = 0;
|
||||
|
||||
@ -23,13 +23,15 @@
|
||||
#
|
||||
#***************************************************************************
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
BEGIN {
|
||||
push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
|
||||
push(@INC, ".");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Basename;
|
||||
|
||||
use serverhelp qw(
|
||||
server_pidfilename
|
||||
@ -57,6 +59,7 @@ my $gopher = 0;
|
||||
my $flags = "";
|
||||
my $path = '.';
|
||||
my $logdir = $path .'/log';
|
||||
my $piddir;
|
||||
|
||||
while(@ARGV) {
|
||||
if($ARGV[0] eq '--pidfile') {
|
||||
@ -138,14 +141,24 @@ while(@ARGV) {
|
||||
shift @ARGV;
|
||||
}
|
||||
|
||||
if(!$srcdir) {
|
||||
$srcdir = $ENV{'srcdir'} || '.';
|
||||
#***************************************************************************
|
||||
# Initialize command line option dependent variables
|
||||
#
|
||||
|
||||
if($pidfile) {
|
||||
# Use our pidfile directory to store the other pidfiles
|
||||
$piddir = dirname($pidfile);
|
||||
}
|
||||
if(!$pidfile) {
|
||||
$pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
|
||||
else {
|
||||
# Use the current directory to store all the pidfiles
|
||||
$piddir = $path;
|
||||
$pidfile = server_pidfilename($piddir, $proto, $ipvnum, $idnum);
|
||||
}
|
||||
if(!$portfile) {
|
||||
$portfile = "$path/". server_portfilename($proto, $ipvnum, $idnum);
|
||||
$portfile = server_portfilename($piddir, $proto, $ipvnum, $idnum);
|
||||
}
|
||||
if(!$srcdir) {
|
||||
$srcdir = $ENV{'srcdir'} || '.';
|
||||
}
|
||||
if(!$logfile) {
|
||||
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
|
||||
|
||||
@ -23,14 +23,14 @@
|
||||
#
|
||||
#***************************************************************************
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
BEGIN {
|
||||
push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
|
||||
push(@INC, ".");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use serverhelp qw(
|
||||
server_pidfilename
|
||||
server_logfilename
|
||||
@ -112,12 +112,16 @@ while(@ARGV) {
|
||||
shift @ARGV;
|
||||
}
|
||||
|
||||
#***************************************************************************
|
||||
# Initialize command line option dependent variables
|
||||
#
|
||||
|
||||
if(!$pidfile) {
|
||||
$pidfile = server_pidfilename($path, $proto, $ipvnum, $idnum);
|
||||
}
|
||||
if(!$srcdir) {
|
||||
$srcdir = $ENV{'srcdir'} || '.';
|
||||
}
|
||||
if(!$pidfile) {
|
||||
$pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
|
||||
}
|
||||
if(!$logfile) {
|
||||
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
|
||||
}
|
||||
|
||||
@ -152,18 +152,19 @@ my $VCURL=$CURL; # what curl binary to use to verify the servers with
|
||||
my $ACURL=$VCURL; # what curl binary to use to talk to APIs (relevant for CI)
|
||||
# ACURL is handy to set to the system one for reliability
|
||||
my $DBGCURL=$CURL; #"../src/.libs/curl"; # alternative for debugging
|
||||
my $LOGDIR="log";
|
||||
my $TESTDIR="$srcdir/data";
|
||||
my $LIBDIR="./libtest";
|
||||
my $UNITDIR="./unit";
|
||||
my $LOGDIR="log";
|
||||
# TODO: $LOGDIR could eventually change later on, so must regenerate all the
|
||||
# paths depending on it after $LOGDIR itself changes.
|
||||
my $PIDDIR = "$LOGDIR/server";
|
||||
# TODO: change this to use server_inputfilename()
|
||||
my $SERVERIN="$LOGDIR/server.input"; # what curl sent the server
|
||||
my $SERVER2IN="$LOGDIR/server2.input"; # what curl sent the second server
|
||||
my $PROXYIN="$LOGDIR/proxy.input"; # what curl sent the proxy
|
||||
my $SOCKSIN="$LOGDIR/socksd-request.log"; # what curl sent to the SOCKS proxy
|
||||
my $CURLLOG="commands.log"; # all command lines run
|
||||
my $CURLLOG="$LOGDIR/commands.log"; # all command lines run
|
||||
my $FTPDCMD="$LOGDIR/ftpserver.cmd"; # copy server instructions here
|
||||
my $SERVERLOGS_LOCK="$LOGDIR/serverlogs.lock"; # server logs advisor read lock
|
||||
my $CURLCONFIG="../curl-config"; # curl-config from current build
|
||||
@ -384,9 +385,9 @@ sub init_serverpidfile_hash {
|
||||
for my $ipvnum ((4, 6)) {
|
||||
for my $idnum ((1, 2, 3)) {
|
||||
my $serv = servername_id("$proto$ssl", $ipvnum, $idnum);
|
||||
my $pidf = server_pidfilename("$proto$ssl", $ipvnum, $idnum);
|
||||
my $pidf = server_pidfilename($PIDDIR, "$proto$ssl", $ipvnum, $idnum);
|
||||
$serverpidfile{$serv} = $pidf;
|
||||
my $portf = server_portfilename("$proto$ssl", $ipvnum, $idnum);
|
||||
my $portf = server_portfilename($PIDDIR, "$proto$ssl", $ipvnum, $idnum);
|
||||
$serverportfile{$serv} = $portf;
|
||||
}
|
||||
}
|
||||
@ -397,9 +398,9 @@ sub init_serverpidfile_hash {
|
||||
for my $ipvnum ((4, 6)) {
|
||||
for my $idnum ((1, 2)) {
|
||||
my $serv = servername_id($proto, $ipvnum, $idnum);
|
||||
my $pidf = server_pidfilename($proto, $ipvnum, $idnum);
|
||||
my $pidf = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum);
|
||||
$serverpidfile{$serv} = $pidf;
|
||||
my $portf = server_portfilename($proto, $ipvnum, $idnum);
|
||||
my $portf = server_portfilename($PIDDIR, $proto, $ipvnum, $idnum);
|
||||
$serverportfile{$serv} = $portf;
|
||||
}
|
||||
}
|
||||
@ -407,9 +408,9 @@ sub init_serverpidfile_hash {
|
||||
for my $proto (('http', 'imap', 'pop3', 'smtp', 'http/2', 'http/3')) {
|
||||
for my $ssl (('', 's')) {
|
||||
my $serv = servername_id("$proto$ssl", "unix", 1);
|
||||
my $pidf = server_pidfilename("$proto$ssl", "unix", 1);
|
||||
my $pidf = server_pidfilename($PIDDIR, "$proto$ssl", "unix", 1);
|
||||
$serverpidfile{$serv} = $pidf;
|
||||
my $portf = server_portfilename("$proto$ssl", "unix", 1);
|
||||
my $portf = server_portfilename($PIDDIR, "$proto$ssl", "unix", 1);
|
||||
$serverportfile{$serv} = $portf;
|
||||
}
|
||||
}
|
||||
@ -757,7 +758,7 @@ sub stopserver {
|
||||
my $proto = $1;
|
||||
my $idnum = ($2 && ($2 > 1)) ? $2 : 1;
|
||||
my $ipvnum = ($3 && ($3 =~ /6$/)) ? 6 : 4;
|
||||
killsockfilters($proto, $ipvnum, $idnum, $verbose);
|
||||
killsockfilters($PIDDIR, $proto, $ipvnum, $idnum, $verbose);
|
||||
}
|
||||
#
|
||||
# All servers relative to the given one must be stopped also
|
||||
@ -1065,7 +1066,7 @@ sub verifyrtsp {
|
||||
#
|
||||
sub verifyssh {
|
||||
my ($proto, $ipvnum, $idnum, $ip, $port) = @_;
|
||||
my $pidfile = server_pidfilename($proto, $ipvnum, $idnum);
|
||||
my $pidfile = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum);
|
||||
my $pid = processexists($pidfile);
|
||||
if($pid < 0) {
|
||||
logmsg "RUN: SSH server has died after starting up\n";
|
||||
@ -1119,7 +1120,7 @@ sub verifysftp {
|
||||
sub verifyhttptls {
|
||||
my ($proto, $ipvnum, $idnum, $ip, $port) = @_;
|
||||
my $server = servername_id($proto, $ipvnum, $idnum);
|
||||
my $pidfile = server_pidfilename($proto, $ipvnum, $idnum);
|
||||
my $pidfile = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum);
|
||||
|
||||
my $verifyout = "$LOGDIR/".
|
||||
servername_canon($proto, $ipvnum, $idnum) .'_verify.out';
|
||||
@ -1196,7 +1197,7 @@ sub verifyhttptls {
|
||||
#
|
||||
sub verifysocks {
|
||||
my ($proto, $ipvnum, $idnum, $ip, $port) = @_;
|
||||
my $pidfile = server_pidfilename($proto, $ipvnum, $idnum);
|
||||
my $pidfile = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum);
|
||||
my $pid = processexists($pidfile);
|
||||
if($pid < 0) {
|
||||
logmsg "RUN: SOCKS server has died after starting up\n";
|
||||
@ -2717,14 +2718,15 @@ sub clearlocks {
|
||||
#
|
||||
sub cleardir {
|
||||
my $dir = $_[0];
|
||||
my $done = 1;
|
||||
my $done = 1; # success
|
||||
my $file;
|
||||
|
||||
# Get all files
|
||||
opendir(my $dh, $dir) ||
|
||||
return 0; # can't open dir
|
||||
while($file = readdir($dh)) {
|
||||
if(($file !~ /^(\.|\.\.)\z/)) {
|
||||
# Don't clear the $PIDDIR since those need to live beyond one test
|
||||
if(($file !~ /^(\.|\.\.)\z/) && "$dir/$file" ne $PIDDIR) {
|
||||
if(-d "$dir/$file") {
|
||||
if(!cleardir("$dir/$file")) {
|
||||
$done = 0;
|
||||
@ -4055,7 +4057,7 @@ sub singletest_run {
|
||||
logmsg "$CMDLINE\n";
|
||||
}
|
||||
|
||||
open(my $cmdlog, ">", "$LOGDIR/$CURLLOG") || die "Failure writing log file";
|
||||
open(my $cmdlog, ">", $CURLLOG) || die "Failure writing log file";
|
||||
print $cmdlog "$CMDLINE\n";
|
||||
close($cmdlog) || die "Failure writing log file";
|
||||
|
||||
@ -4860,7 +4862,7 @@ sub stopservers {
|
||||
#
|
||||
# kill sockfilter processes for all pingpong servers
|
||||
#
|
||||
killallsockfilters($verb);
|
||||
killallsockfilters($PIDDIR, $verb);
|
||||
#
|
||||
# kill all server pids from %run hash clearing them
|
||||
#
|
||||
@ -5991,6 +5993,7 @@ $SOCKSUNIXPATH = $pwd."/socks$$.sock"; # HTTP server Unix domain socket path,
|
||||
|
||||
cleardir($LOGDIR);
|
||||
mkdir($LOGDIR, 0777);
|
||||
mkdir($PIDDIR, 0777);
|
||||
|
||||
#######################################################################
|
||||
# initialize some variables
|
||||
|
||||
@ -27,13 +27,14 @@
|
||||
# harness. Actually just a layer that runs stunnel properly using the
|
||||
# non-secure test harness servers.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
BEGIN {
|
||||
push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
|
||||
push(@INC, ".");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Cwd;
|
||||
use Cwd 'abs_path';
|
||||
|
||||
@ -183,7 +184,7 @@ while(@ARGV) {
|
||||
# Initialize command line option dependent variables
|
||||
#
|
||||
if(!$pidfile) {
|
||||
$pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
|
||||
$pidfile = server_pidfilename($path, $proto, $ipvnum, $idnum);
|
||||
}
|
||||
if(!$logfile) {
|
||||
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
|
||||
|
||||
@ -146,18 +146,18 @@ sub servername_canon {
|
||||
# Return file name for server pid file.
|
||||
#
|
||||
sub server_pidfilename {
|
||||
my ($proto, $ipver, $idnum) = @_;
|
||||
my ($piddir, $proto, $ipver, $idnum) = @_;
|
||||
my $trailer = '_server.pid';
|
||||
return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
}
|
||||
|
||||
#***************************************************************************
|
||||
# Return file name for server port file.
|
||||
#
|
||||
sub server_portfilename {
|
||||
my ($proto, $ipver, $idnum) = @_;
|
||||
my ($piddir, $proto, $ipver, $idnum) = @_;
|
||||
my $trailer = '_server.port';
|
||||
return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
}
|
||||
|
||||
|
||||
@ -206,11 +206,11 @@ sub server_outputfilename {
|
||||
# Return file name for main or primary sockfilter pid file.
|
||||
#
|
||||
sub mainsockf_pidfilename {
|
||||
my ($proto, $ipver, $idnum) = @_;
|
||||
my ($piddir, $proto, $ipver, $idnum) = @_;
|
||||
die "unsupported protocol: '$proto'" unless($proto &&
|
||||
(lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
|
||||
my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.pid':'_sockfilt.pid';
|
||||
return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
}
|
||||
|
||||
|
||||
@ -230,11 +230,11 @@ sub mainsockf_logfilename {
|
||||
# Return file name for data or secondary sockfilter pid file.
|
||||
#
|
||||
sub datasockf_pidfilename {
|
||||
my ($proto, $ipver, $idnum) = @_;
|
||||
my ($piddir, $proto, $ipver, $idnum) = @_;
|
||||
die "unsupported protocol: '$proto'" unless($proto &&
|
||||
(lc($proto) =~ /^ftps?$/));
|
||||
my $trailer = '_sockdata.pid';
|
||||
return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -177,15 +177,18 @@ while(@ARGV) {
|
||||
shift @ARGV;
|
||||
}
|
||||
|
||||
#***************************************************************************
|
||||
# Initialize command line option dependent variables
|
||||
#
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Default ssh daemon pid file name
|
||||
#
|
||||
if(!$pidfile) {
|
||||
$pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
|
||||
$pidfile = server_pidfilename($path, $proto, $ipvnum, $idnum);
|
||||
}
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# ssh and sftp server log file names
|
||||
#
|
||||
|
||||
@ -117,7 +117,7 @@ if(!$srcdir) {
|
||||
$srcdir = $ENV{'srcdir'} || '.';
|
||||
}
|
||||
if(!$pidfile) {
|
||||
$pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
|
||||
$pidfile = server_pidfilename($path, $proto, $ipvnum, $idnum);
|
||||
}
|
||||
if(!$logfile) {
|
||||
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user