Browse Source

[mod_fastcgi,mod_scgi] check for spawning on same unix socket (#319)

error out if duplicated unix socket path and different bin-path is
used by lighttpd to start the backend.  This is an error.
Updates commits 97556d99 and b67ff2aa

x-ref:
  "Should warn if two FastCGI servers point to same socket file"
  https://redmine.lighttpd.net/issues/319
personal/stbuehler/mod-csrf-old
Glenn Strauss 5 years ago
parent
commit
c1af146a6e
  1. 9
      src/mod_fastcgi.c
  2. 9
      src/mod_scgi.c

9
src/mod_fastcgi.c

@ -1194,7 +1194,8 @@ static fcgi_extension_host * unixsocket_is_dup(plugin_data *p, size_t used, buff
for (n = 0; n < ex->used; ++n) {
fcgi_extension_host *host = ex->hosts[n];
if (!buffer_string_is_empty(host->unixsocket)
&& buffer_is_equal(host->unixsocket, unixsocket))
&& buffer_is_equal(host->unixsocket, unixsocket)
&& !buffer_string_is_empty(host->bin_path))
return host;
}
}
@ -1392,6 +1393,12 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
if (!buffer_string_is_empty(host->bin_path)) {
fcgi_extension_host *duplicate = unixsocket_is_dup(p, i+1, host->unixsocket);
if (NULL != duplicate) {
if (!buffer_is_equal(host->bin_path, duplicate->bin_path)) {
log_error_write(srv, __FILE__, __LINE__, "sb",
"duplicate unixsocket path:",
host->unixsocket);
goto error;
}
fastcgi_host_free(host);
host = duplicate;
++host->refcount;

9
src/mod_scgi.c

@ -961,7 +961,8 @@ static scgi_extension_host * unixsocket_is_dup(plugin_data *p, size_t used, buff
for (n = 0; n < ex->used; ++n) {
scgi_extension_host *host = ex->hosts[n];
if (!buffer_string_is_empty(host->unixsocket)
&& buffer_is_equal(host->unixsocket, unixsocket))
&& buffer_is_equal(host->unixsocket, unixsocket)
&& !buffer_string_is_empty(host->bin_path))
return host;
}
}
@ -1144,6 +1145,12 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) {
if (!buffer_string_is_empty(df->bin_path)) {
scgi_extension_host *duplicate = unixsocket_is_dup(p, i+1, df->unixsocket);
if (NULL != duplicate) {
if (!buffer_is_equal(df->bin_path, duplicate->bin_path)) {
log_error_write(srv, __FILE__, __LINE__, "sb",
"duplicate unixsocket path:",
df->unixsocket);
goto error;
}
scgi_host_free(df);
df = duplicate;
++df->refcount;

Loading…
Cancel
Save