*** Foswiki/Engine/FastCGI.pm 2010/11/08 00:48:35 1.1 --- Foswiki/Engine/FastCGI.pm 2010/11/08 02:21:57 *************** *** 87,94 **** --- 87,112 ---- my $sock = 0; if ($listen) { + # The permissions of a unix domain socket need to allow the webserver to read + # the socket, so setting the mode is a common use case. My hack is to add the + # mode to the end of the listen line after a colon, but now you cannot have a colon + # in a socket filename. -dave@jetcafe.org + my $mode = 0600; + if ( $listen =~ /^(\/.*):0?([0-7]+)$/o) { + $listen = $1; + $mode = oct($2); + } else { + # $listen is tainted of course + if ($listen =~ /^(.*)$/) { $listen = $1 }; + } + $sock = FCGI::OpenSocket( $listen, 100 ) or die "Failed to create FastCGI socket: $!"; + + if ( $listen =~ /^\//o ) { + chmod($mode,$listen) + or die "Failed to chmod listen socket $listen to mode '$mode': $!'"; + } } $args ||= {}; my $r = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%ENV, $sock,