summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2016-07-10 17:22:10 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2016-07-10 17:24:39 -0400
commitc1af146a6e17f22ee401fe787a161c36bfabe4cb (patch)
treed488f4cc6210acf4dc4ef60bcb4be7cb79455905 /src
parentb67ff2aaca9f741a1283320180ca598b57f65765 (diff)
downloadlighttpd-git-c1af146a6e17f22ee401fe787a161c36bfabe4cb.tar.gz
[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
Diffstat (limited to 'src')
-rw-r--r--src/mod_fastcgi.c9
-rw-r--r--src/mod_scgi.c9
2 files changed, 16 insertions, 2 deletions
diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c
index d43961de..31c2e62d 100644
--- a/src/mod_fastcgi.c
+++ b/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;
diff --git a/src/mod_scgi.c b/src/mod_scgi.c
index 88f50d82..584c20a1 100644
--- a/src/mod_scgi.c
+++ b/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;