diff options
Diffstat (limited to 'tests/servers.pm')
-rw-r--r-- | tests/servers.pm | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/tests/servers.pm b/tests/servers.pm index 32f66552a..23b860555 100644 --- a/tests/servers.pm +++ b/tests/servers.pm @@ -170,8 +170,8 @@ sub checkcmd { ####################################################################### # Initialize configuration variables sub initserverconfig { - $SOCKSUNIXPATH = "$PIDDIR/socks.sock"; # SOCKS server Unix domain socket path - $HTTPUNIXPATH = "$PIDDIR/http.sock"; # HTTP server Unix domain socket path + $SOCKSUNIXPATH = "$LOGDIR/$PIDDIR/socks.sock"; # SOCKS Unix domain socket + $HTTPUNIXPATH = "$LOGDIR/$PIDDIR/http.sock"; # HTTP Unix domain socket $stunnel = checkcmd("stunnel4") || checkcmd("tstunnel") || checkcmd("stunnel"); # get the name of the current user @@ -195,9 +195,11 @@ 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($PIDDIR, "$proto$ssl", $ipvnum, $idnum); + my $pidf = server_pidfilename("$LOGDIR/$PIDDIR", "$proto$ssl", + $ipvnum, $idnum); $serverpidfile{$serv} = $pidf; - my $portf = server_portfilename($PIDDIR, "$proto$ssl", $ipvnum, $idnum); + my $portf = server_portfilename("$LOGDIR/$PIDDIR", "$proto$ssl", + $ipvnum, $idnum); $serverportfile{$serv} = $portf; } } @@ -208,9 +210,11 @@ 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($PIDDIR, $proto, $ipvnum, $idnum); + my $pidf = server_pidfilename("$LOGDIR/$PIDDIR", $proto, $ipvnum, + $idnum); $serverpidfile{$serv} = $pidf; - my $portf = server_portfilename($PIDDIR, $proto, $ipvnum, $idnum); + my $portf = server_portfilename("$LOGDIR/$PIDDIR", $proto, $ipvnum, + $idnum); $serverportfile{$serv} = $portf; } } @@ -218,9 +222,11 @@ 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($PIDDIR, "$proto$ssl", "unix", 1); + my $pidf = server_pidfilename("$LOGDIR/$PIDDIR", "$proto$ssl", + "unix", 1); $serverpidfile{$serv} = $pidf; - my $portf = server_portfilename($PIDDIR, "$proto$ssl", "unix", 1); + my $portf = server_portfilename("$LOGDIR/$PIDDIR", "$proto$ssl", + "unix", 1); $serverportfile{$serv} = $portf; } } @@ -418,7 +424,7 @@ sub stopserver { my $proto = $1; my $idnum = ($2 && ($2 > 1)) ? $2 : 1; my $ipvnum = ($3 && ($3 =~ /6$/)) ? 6 : 4; - killsockfilters($PIDDIR, $proto, $ipvnum, $idnum, $verbose); + killsockfilters("$LOGDIR/$PIDDIR", $proto, $ipvnum, $idnum, $verbose); } # # All servers relative to the given one must be stopped also @@ -727,7 +733,8 @@ sub verifyrtsp { # sub verifyssh { my ($proto, $ipvnum, $idnum, $ip, $port) = @_; - my $pidfile = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum); + my $pidfile = server_pidfilename("$LOGDIR/$PIDDIR", $proto, $ipvnum, + $idnum); my $pid = processexists($pidfile); if($pid < 0) { logmsg "RUN: SSH server has died after starting up\n"; @@ -757,7 +764,7 @@ sub verifysftp { } # Connect to sftp server, authenticate and run a remote pwd # command using our generated configuration and key files - my $cmd = "\"$sftp\" -b $PIDDIR/$sftpcmds -F $PIDDIR/$sftpconfig -S \"$ssh\" $ip > $sftplog 2>&1"; + my $cmd = "\"$sftp\" -b $LOGDIR/$PIDDIR/$sftpcmds -F $LOGDIR/$PIDDIR/$sftpconfig -S \"$ssh\" $ip > $sftplog 2>&1"; my $res = runclient($cmd); # Search for pwd command response in log file if(open(my $sftplogfile, "<", "$sftplog")) { @@ -781,7 +788,8 @@ sub verifysftp { sub verifyhttptls { my ($proto, $ipvnum, $idnum, $ip, $port) = @_; my $server = servername_id($proto, $ipvnum, $idnum); - my $pidfile = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum); + my $pidfile = server_pidfilename("$LOGDIR/$PIDDIR", $proto, $ipvnum, + $idnum); my $verifyout = "$LOGDIR/". servername_canon($proto, $ipvnum, $idnum) .'_verify.out'; @@ -858,7 +866,8 @@ sub verifyhttptls { # sub verifysocks { my ($proto, $ipvnum, $idnum, $ip, $port) = @_; - my $pidfile = server_pidfilename($PIDDIR, $proto, $ipvnum, $idnum); + my $pidfile = server_pidfilename("$LOGDIR/$PIDDIR", $proto, $ipvnum, + $idnum); my $pid = processexists($pidfile); if($pid < 0) { logmsg "RUN: SOCKS server has died after starting up\n"; @@ -1120,7 +1129,7 @@ sub runhttpserver { $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; $flags .= "--logdir \"$LOGDIR\" "; $flags .= "--portfile $portfile "; - $flags .= "--config $FTPDCMD "; + $flags .= "--config $LOGDIR/$FTPDCMD "; $flags .= "--id $idnum " if($idnum > 1); if($ipvnum eq "unix") { $flags .= "--unix-socket '$port_or_path' "; @@ -1887,7 +1896,7 @@ sub runsshserver { } my $hostfile; - if(!open($hostfile, "<", $PIDDIR . "/" . $hstpubmd5f) || + if(!open($hostfile, "<", "$LOGDIR/$PIDDIR/$hstpubmd5f") || (read($hostfile, $SSHSRVMD5, 32) != 32) || !close($hostfile) || ($SSHSRVMD5 !~ /^[a-f0-9]{32}$/i)) @@ -1898,7 +1907,7 @@ sub runsshserver { die $msg; } - if(!open($hostfile, "<", $PIDDIR . "/" . $hstpubsha256f) || + if(!open($hostfile, "<", "$LOGDIR/$PIDDIR/$hstpubsha256f") || (read($hostfile, $SSHSRVSHA256, 48) == 0) || !close($hostfile)) { @@ -1947,7 +1956,7 @@ sub runmqttserver { " --port 0 ". " --pidfile $pidfile". " --portfile $portfile". - " --config $FTPDCMD". + " --config $LOGDIR/$FTPDCMD". " --logfile $logfile". " --logdir $LOGDIR"; my ($sockspid, $pid2) = startnew($cmd, $pidfile, 30, 0); @@ -2008,7 +2017,7 @@ sub runsocksserver { " --logfile $logfile". " --unix-socket $SOCKSUNIXPATH". " --backend $HOSTIP". - " --config $FTPDCMD"; + " --config $LOGDIR/$FTPDCMD"; } else { $cmd="server/socksd".exe_ext('SRV'). " --port 0 ". @@ -2017,7 +2026,7 @@ sub runsocksserver { " --reqfile $LOGDIR/$SOCKSIN". " --logfile $logfile". " --backend $HOSTIP". - " --config $FTPDCMD"; + " --config $LOGDIR/$FTPDCMD"; } my ($sockspid, $pid2) = startnew($cmd, $pidfile, 30, 0); @@ -2912,7 +2921,7 @@ sub stopservers { # # kill sockfilter processes for all pingpong servers # - killallsockfilters($PIDDIR, $verb); + killallsockfilters("$LOGDIR/$PIDDIR", $verb); # # kill all server pids from %run hash clearing them # |