mod_cgid.c revision 36906f11e659bf5e500ccc93025dab95cd790291
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering/* ====================================================================
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * The Apache Software License, Version 1.1
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * Copyright (c) 2000 The Apache Software Foundation. All rights
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * Redistribution and use in source and binary forms, with or without
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * modification, are permitted provided that the following conditions
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * 1. Redistributions of source code must retain the above copyright
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * notice, this list of conditions and the following disclaimer.
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * 2. Redistributions in binary form must reproduce the above copyright
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * notice, this list of conditions and the following disclaimer in
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * the documentation and/or other materials provided with the
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * distribution.
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * 3. The end-user documentation included with the redistribution,
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * if any, must include the following acknowledgment:
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * "This product includes software developed by the
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * Apache Software Foundation (http://www.apache.org/)."
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * Alternately, this acknowledgment may appear in the software itself,
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * if and wherever such third-party acknowledgments normally appear.
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * 4. The names "Apache" and "Apache Software Foundation" must
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering * not be used to endorse or promote products derived from this
#define CORE_PRIVATE
#include "apr_lib.h"
#include "apr_general.h"
#include "apr_file_io.h"
#include "apr_portable.h"
#include "httpd.h"
#include "http_config.h"
#include "http_request.h"
#include "http_core.h"
#include "http_protocol.h"
#include "http_main.h"
#include "http_log.h"
#include "util_script.h"
#include "http_conf_globals.h"
#include "buff.h"
#include "ap_mpm.h"
#include "iol_socket.h"
#ifndef UNIX_PATH_MAX
#ifndef sockaddr_un
struct sockaddr_un {
unsigned short sun_family;
static int once_through = 0;
const char *sockname;
char *logname;
long logbytes;
int bufbytes;
int x, numwords;
char **av;
int idx = 0;
++numwords;
if (path) {
if (user) {
if (group) {
ap_unescape_url(w);
return av;
int pid = 0;
/* the fd on r->server->error_log is closed, but we need somewhere to * put the error messages from the log_* functions. So, we use stderr,
if (pos) {
return (pid);
return (pid);
return (pid);
return (pid);
if (shellcmd) {
env);
if (shellcmd) {
env);
return (pid);
#ifdef APR_HAS_OTHER_CHILD
switch (reason) {
case APR_OC_REASON_DEATH:
case APR_OC_REASON_LOST:
case APR_OC_REASON_RESTART:
case APR_OC_REASON_UNREGISTER:
int i, len, j;
unsigned char *data;
char **environ;
void **dconf;
#ifdef RLIMIT_CPU
#ifdef RLIMIT_NPROC
int len;
char *data;
NULL);
for (i =0; env[i]; i++) {
for (i = 0; env[i]; i++) {
#ifdef RLIMIT_CPU
len = 0;
len = 0;
#ifdef RLIMIT_NPROC
len = 0;
char *argv0;
char *filename;
char **env;
ap_pool_t *p;
request_rec *r;
r->pool = p;
int pid;
int errfile;
if (sd2 < 0) {
else if (pid == 0) {
int pid;
int tempfd;
if (once_through > 0) {
else if (pid == 0) {
#ifdef APR_HAS_OTHER_CHILD
else once_through++;
cgid_server_conf *c =
return NULL;
return NULL;
return NULL;
return NULL;
{NULL}
return ret;
ap_close(f);
return ret;
return ret;
&& *dbuf) {
ap_close(f);
return ret;
int sd;
char **env;
int nbytes;
return DECLINED;
argv0++;
argv0++;
char *newfile;
ap_add_cgi_vars(r);
return retval;
argv0++;
if (ap_should_client_block(r)) {
dbpos = 0;
while ((len_read =
const char *location;
int ret;
return OK;
return REDIRECT;
if (!r->header_only) {
{NULL}
static void register_hook(void)