[Remove entries to the current 2.0 section below, when backported]
+ *) mod_cgid: Catch configuration problem where two web server instances
+ share same ServerRoot but admin forgot to use ScriptSock.
+ [Jeff Trawick]
+
*) mod_cgi: Ensure that all stderr is logged for a script which returns
a Location header to generate a non-local redirect. PR 20111.
[Joe Orton]
static server_rec *root_server = NULL;
static apr_pool_t *root_pool = NULL;
static const char *sockname;
+static pid_t parent_pid;
/* Read and discard the data in the brigade produced by a CGI script */
static void discard_script_output(apr_bucket_brigade *bb);
* to find the script pid when it is time for that
* process to be cleaned up
*/
+ pid_t ppid; /* sanity check for config problems leading to
+ * wrong cgid socket use
+ */
int core_module_index;
int have_suexec;
int suexec_module_index;
apr_status_t stat;
req.req_type = req_type;
+ req.ppid = parent_pid;
req.conn_id = r->connection->id;
req.core_module_index = core_module.module_index;
if (suexec_mod) {
continue;
}
+ if (cgid_req.ppid != parent_pid) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, 0, main_server,
+ "CGI request received from wrong server instance; "
+ "see ScriptSock directive");
+ close(sd2);
+ continue;
+ }
+
if (cgid_req.req_type == GETPID_REQ) {
pid_t pid;
for (m = ap_preloaded_modules; *m != NULL; m++)
total_modules++;
+ parent_pid = getpid();
sockname = ap_server_root_relative(p, sockname);
ret = cgid_start(p, main_server, procnew);
if (ret != OK ) {
/* we got a socket, and there is already a cleanup registered for it */
req.req_type = GETPID_REQ;
+ req.ppid = parent_pid;
req.conn_id = info->r->connection->id;
stat = sock_write(sd, &req, sizeof(req));