From: Daniel Stenberg Date: Sat, 20 May 2023 15:56:37 +0000 (+0200) Subject: tests/servers: generate temp names in /tmp for unix domain sockets X-Git-Tag: curl-8_2_0~160 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8cf41895290b35c2d04ebf5513562b9833a79af2;p=thirdparty%2Fcurl.git tests/servers: generate temp names in /tmp for unix domain sockets ... instead of putting them in the regular pid directories because systems generally have strict length requirements for the path name to be shorter than 107 bytes and we easily hit that boundary otherwise. The new concept generates two random names: one for the socks daemon and one for http. Reported-by: Andy Fiddaman Fixes #11152 Closes #11166 --- diff --git a/tests/data/test1467 b/tests/data/test1467 index 4770504c7f..4e1d68fecf 100644 --- a/tests/data/test1467 +++ b/tests/data/test1467 @@ -42,7 +42,7 @@ socks5unix HTTP GET via SOCKS5 proxy via unix sockets ---socks5 localhost%PWD/%SOCKSUNIXPATH http://%HOSTIP:%HTTPPORT/%TESTNUMBER +--socks5 localhost%SOCKSUNIXPATH http://%HOSTIP:%HTTPPORT/%TESTNUMBER diff --git a/tests/data/test1468 b/tests/data/test1468 index 207990e944..b4030babd8 100644 --- a/tests/data/test1468 +++ b/tests/data/test1468 @@ -43,7 +43,7 @@ socks5unix HTTP GET with host name using SOCKS5h via unix sockets -http://this.is.a.host.name:%HTTPPORT/%TESTNUMBER --proxy socks5h://localhost%PWD/%SOCKSUNIXPATH +http://this.is.a.host.name:%HTTPPORT/%TESTNUMBER --proxy socks5h://localhost%SOCKSUNIXPATH diff --git a/tests/data/test1470 b/tests/data/test1470 index bec54cfc04..c9dd8f4675 100644 --- a/tests/data/test1470 +++ b/tests/data/test1470 @@ -45,7 +45,7 @@ socks5unix HTTPS GET with host name using SOCKS5h via unix sockets -https://this.is.a.host.name:%HTTPSPORT/%TESTNUMBER -k --proxy socks5h://localhost%PWD/%SOCKSUNIXPATH +https://this.is.a.host.name:%HTTPSPORT/%TESTNUMBER -k --proxy socks5h://localhost%SOCKSUNIXPATH diff --git a/tests/servers.pm b/tests/servers.pm index 465f82bcec..9c550a8cb3 100644 --- a/tests/servers.pm +++ b/tests/servers.pm @@ -180,11 +180,19 @@ sub getfreeport { return $server->sockport(); } +use File::Temp qw/ tempfile/; + ####################################################################### # Initialize configuration variables sub initserverconfig { - $SOCKSUNIXPATH = "$LOGDIR/$PIDDIR/socks.sock"; # SOCKS Unix domain socket - $HTTPUNIXPATH = "$LOGDIR/$PIDDIR/http.sock"; # HTTP Unix domain socket + my ($fh, $socks) = tempfile("/tmp/curl-socksd-XXXXXXXX"); + close($fh); + unlink($socks); + my ($f2, $http) = tempfile("/tmp/curl-http-XXXXXXXX"); + close($f2); + unlink($http); + $SOCKSUNIXPATH = $socks; # SOCKS Unix domain socket + $HTTPUNIXPATH = $http; # HTTP Unix domain socket $stunnel = checkcmd("stunnel4") || checkcmd("tstunnel") || checkcmd("stunnel"); # get the name of the current user