Browse Source

[mod_fastcgi,mod_scgi] warn if invalid "bin-path"

e.g. if /usr/bin/php-cgi does not exist

A distribution package might need to be installed:
'php-cli' Fedora package; 'php7.0-cgi' or 'php5-cgi' Debian package
personal/stbuehler/mod-csrf
Glenn Strauss 5 years ago
parent
commit
f9737e50a6
  1. 12
      src/mod_fastcgi.c
  2. 12
      src/mod_scgi.c

12
src/mod_fastcgi.c

@ -1469,6 +1469,18 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
/* a local socket + self spawning */
size_t pno;
struct stat st;
size_t nchars = strcspn(host->bin_path->ptr, " \t");
char c = host->bin_path->ptr[nchars];
host->bin_path->ptr[nchars] = '\0';
if (0 == nchars || 0 != stat(host->bin_path->ptr, &st) || !S_ISREG(st.st_mode) || !(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
host->bin_path->ptr[nchars] = c;
log_error_write(srv, __FILE__, __LINE__, "SSs",
"invalid \"bin-path\" => \"", host->bin_path->ptr,
"\" (check that file exists, is regular file, and is executable by lighttpd)");
}
host->bin_path->ptr[nchars] = c;
if (s->debug) {
log_error_write(srv, __FILE__, __LINE__, "ssbsdsbsd",
"--- fastcgi spawning local",

12
src/mod_scgi.c

@ -1214,6 +1214,18 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) {
/* a local socket + self spawning */
size_t pno;
struct stat st;
size_t nchars = strcspn(df->bin_path->ptr, " \t");
char c = df->bin_path->ptr[nchars];
df->bin_path->ptr[nchars] = '\0';
if (0 == nchars || 0 != stat(df->bin_path->ptr, &st) || !S_ISREG(st.st_mode) || !(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
df->bin_path->ptr[nchars] = c;
log_error_write(srv, __FILE__, __LINE__, "SSs",
"invalid \"bin-path\" => \"", df->bin_path->ptr,
"\" (check that file exists, is regular file, and is executable by lighttpd)");
}
df->bin_path->ptr[nchars] = c;
/* HACK: just to make sure the adaptive spawing is disabled */
df->min_procs = df->max_procs;

Loading…
Cancel
Save