]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests/servers: generate temp names in /tmp for unix domain sockets
authorDaniel Stenberg <daniel@haxx.se>
Sat, 20 May 2023 15:56:37 +0000 (17:56 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 2 Jun 2023 21:10:46 +0000 (23:10 +0200)
... 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

tests/data/test1467
tests/data/test1468
tests/data/test1470
tests/servers.pm

index 4770504c7f577751753c0954e839f6bde2fd969f..4e1d68fecf0114ed822635ba83aa031148aa7d50 100644 (file)
@@ -42,7 +42,7 @@ socks5unix
 HTTP GET via SOCKS5 proxy via unix sockets
  </name>
  <command>
---socks5 localhost%PWD/%SOCKSUNIXPATH http://%HOSTIP:%HTTPPORT/%TESTNUMBER
+--socks5 localhost%SOCKSUNIXPATH http://%HOSTIP:%HTTPPORT/%TESTNUMBER
 </command>
 </client>
 
index 207990e9448bfc331eb0be499681107fd4830ef0..b4030babd8394e7aec570ce96df4d6589d8804e5 100644 (file)
@@ -43,7 +43,7 @@ socks5unix
 HTTP GET with host name using SOCKS5h via unix sockets
  </name>
  <command>
-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
 </command>
 </client>
 
index bec54cfc0450b4447a9788a47ba1082e0df2445a..c9dd8f46751bde11ca18e5f8b402e44f67d586a5 100644 (file)
@@ -45,7 +45,7 @@ socks5unix
 HTTPS GET with host name using SOCKS5h via unix sockets
  </name>
  <command>
-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
 </command>
 </client>
 
index 465f82bcec37ff3b8071d78f3925a171da0d7d7c..9c550a8cb3b59a477a120263c48f30b8edee2dfe 100644 (file)
@@ -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