mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Fix the inability to log errors like exec failure in
mod_ext_filter/mod_cgi script children (e.g., exec failure). This was broken after such children stopped inheriting the error log handle. (For this to work with mod_ext_filter, that module's LogStderr option has to be on.) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99211 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
5
CHANGES
5
CHANGES
@@ -2,6 +2,11 @@ Changes with Apache 2.1.0-dev
|
|||||||
|
|
||||||
[Remove entries to the current 2.0 section below, when backported]
|
[Remove entries to the current 2.0 section below, when backported]
|
||||||
|
|
||||||
|
*) Fix the inability to log errors like exec failure in
|
||||||
|
mod_ext_filter/mod_cgi script children (e.g., exec failure). This
|
||||||
|
was broken after such children stopped inheriting the error log
|
||||||
|
handle. [Jeff Trawick]
|
||||||
|
|
||||||
*) Fix a compile failure with recent OpenSSL and picky compilers
|
*) Fix a compile failure with recent OpenSSL and picky compilers
|
||||||
(e.g., OpenSSL 0.9.7a and xlc_r on AIX). [Jeff Trawick]
|
(e.g., OpenSSL 0.9.7a and xlc_r on AIX). [Jeff Trawick]
|
||||||
|
|
||||||
|
@@ -69,6 +69,7 @@
|
|||||||
#include "apr_buckets.h"
|
#include "apr_buckets.h"
|
||||||
#include "util_filter.h"
|
#include "util_filter.h"
|
||||||
#include "util_script.h"
|
#include "util_script.h"
|
||||||
|
#include "util_time.h"
|
||||||
#include "apr_strings.h"
|
#include "apr_strings.h"
|
||||||
#include "apr_hash.h"
|
#include "apr_hash.h"
|
||||||
#include "apr_lib.h"
|
#include "apr_lib.h"
|
||||||
@@ -423,15 +424,25 @@ static apr_status_t ef_close_file(void *vfile)
|
|||||||
return apr_file_close(vfile);
|
return apr_file_close(vfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void child_errfn(apr_pool_t *p, apr_status_t err, const char *desc)
|
static void child_errfn(apr_pool_t *pool, apr_status_t err, const char *description)
|
||||||
{
|
{
|
||||||
request_rec *r;
|
request_rec *r;
|
||||||
void *vr;
|
void *vr;
|
||||||
|
apr_file_t *stderr_log;
|
||||||
|
char errbuf[200];
|
||||||
|
char time_str[APR_CTIME_LEN];
|
||||||
|
|
||||||
apr_pool_userdata_get(&vr, ERRFN_USERDATA_KEY, p);
|
apr_pool_userdata_get(&vr, ERRFN_USERDATA_KEY, pool);
|
||||||
r = vr;
|
r = vr;
|
||||||
|
apr_file_open_stderr(&stderr_log, pool);
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, err, r, "%s", desc);
|
ap_recent_ctime(time_str, apr_time_now());
|
||||||
|
apr_file_printf(stderr_log,
|
||||||
|
"[%s] [client %s] mod_ext_filter (%d)%s: %s\n",
|
||||||
|
time_str,
|
||||||
|
r->connection->remote_ip,
|
||||||
|
err,
|
||||||
|
apr_strerror(err, errbuf, sizeof(errbuf)),
|
||||||
|
description);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init_ext_filter_process: get the external filter process going
|
/* init_ext_filter_process: get the external filter process going
|
||||||
|
@@ -122,8 +122,6 @@ static int is_scriptaliased(request_rec *r)
|
|||||||
#define DEFAULT_LOGBYTES 10385760
|
#define DEFAULT_LOGBYTES 10385760
|
||||||
#define DEFAULT_BUFBYTES 1024
|
#define DEFAULT_BUFBYTES 1024
|
||||||
|
|
||||||
#define ERRFN_USERDATA_KEY "CGICHILDERRFN"
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *logname;
|
const char *logname;
|
||||||
long logbytes;
|
long logbytes;
|
||||||
@@ -385,13 +383,15 @@ static void add_ssi_vars(request_rec *r)
|
|||||||
static void cgi_child_errfn(apr_pool_t *pool, apr_status_t err,
|
static void cgi_child_errfn(apr_pool_t *pool, apr_status_t err,
|
||||||
const char *description)
|
const char *description)
|
||||||
{
|
{
|
||||||
request_rec *r;
|
apr_file_t *stderr_log;
|
||||||
void *vr;
|
char errbuf[200];
|
||||||
|
|
||||||
apr_pool_userdata_get(&vr, ERRFN_USERDATA_KEY, pool);
|
apr_file_open_stderr(&stderr_log, pool);
|
||||||
r = vr;
|
apr_file_printf(stderr_log,
|
||||||
|
"(%d)%s: %s\n",
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, err, r, "%s", description);
|
err,
|
||||||
|
apr_strerror(err, errbuf, sizeof(errbuf)),
|
||||||
|
description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static apr_status_t run_cgi_child(apr_file_t **script_out,
|
static apr_status_t run_cgi_child(apr_file_t **script_out,
|
||||||
@@ -473,8 +473,6 @@ static apr_status_t run_cgi_child(apr_file_t **script_out,
|
|||||||
"couldn't set child process attributes: %s", r->filename);
|
"couldn't set child process attributes: %s", r->filename);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
apr_pool_userdata_set(r, ERRFN_USERDATA_KEY, apr_pool_cleanup_null, p);
|
|
||||||
|
|
||||||
procnew = apr_pcalloc(p, sizeof(*procnew));
|
procnew = apr_pcalloc(p, sizeof(*procnew));
|
||||||
if (e_info->prog_type == RUN_AS_SSI) {
|
if (e_info->prog_type == RUN_AS_SSI) {
|
||||||
SPLIT_AND_PASS_PRETAG_BUCKETS(*(e_info->bb), e_info->ctx,
|
SPLIT_AND_PASS_PRETAG_BUCKETS(*(e_info->bb), e_info->ctx,
|
||||||
|
Reference in New Issue
Block a user