diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c index ce47cdae..1e38befd 100644 --- a/src/mod_fastcgi.c +++ b/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", diff --git a/src/mod_scgi.c b/src/mod_scgi.c index 9b827c3b..348dd1c6 100644 --- a/src/mod_scgi.c +++ b/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;