mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Fix for mod_include. Ryan's patch to check error
codes put a return in the wrong place. Also, the include handler return code wasn't being checked. I don't like macros with returns, so I converted SPLIT_AND_PASS_PRETAG_BUCKETS into a function. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90554 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -137,6 +137,29 @@ typedef struct {
|
||||
int bufbytes;
|
||||
} cgi_server_conf;
|
||||
|
||||
/* This function is used to split the brigade at the beginning of
|
||||
* the tag and forward the pretag buckets before any substitution
|
||||
* work is performed on the tag. This maintains proper ordering.
|
||||
*/
|
||||
static int split_and_pass_pretag_buckets(apr_bucket_brigade **brgd,
|
||||
include_ctx_t *cntxt,
|
||||
ap_filter_t *next)
|
||||
{
|
||||
apr_bucket_brigade *tag_plus;
|
||||
int rv;
|
||||
|
||||
if ((APR_BRIGADE_EMPTY(cntxt->ssi_tag_brigade)) &&
|
||||
(cntxt->head_start_bucket != NULL)) {
|
||||
tag_plus = apr_brigade_split(*brgd, cntxt->head_start_bucket);
|
||||
rv = ap_pass_brigade(next, *brgd);
|
||||
cntxt->bytes_parsed = 0;
|
||||
*brgd = tag_plus;
|
||||
if (rv != APR_SUCCESS) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void *create_cgi_config(apr_pool_t *p, server_rec *s)
|
||||
{
|
||||
cgi_server_conf *c =
|
||||
@@ -440,7 +463,10 @@ static apr_status_t run_cgi_child(apr_file_t **script_out,
|
||||
else {
|
||||
procnew = apr_pcalloc(p, sizeof(*procnew));
|
||||
if (e_info->prog_type == RUN_AS_SSI) {
|
||||
SPLIT_AND_PASS_PRETAG_BUCKETS(*(e_info->bb), e_info->ctx, e_info->next);
|
||||
rc = split_and_pass_pretag_buckets(e_info->bb, e_info->ctx, e_info->next);
|
||||
if (rc != APR_SUCCESS) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
rc = ap_os_create_privileged_process(r, procnew, command, argv, env, procattr, p);
|
||||
@@ -896,6 +922,7 @@ static int handle_exec(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec
|
||||
char *tag = NULL;
|
||||
char *tag_val = NULL;
|
||||
char *file = r->filename;
|
||||
int retval;
|
||||
apr_bucket *tmp_buck;
|
||||
char parsed_string[MAX_STRING_LEN];
|
||||
|
||||
@@ -928,7 +955,11 @@ static int handle_exec(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec
|
||||
}
|
||||
else if (!strcmp(tag, "cgi")) {
|
||||
cgi_pfn_ps(r, tag_val, parsed_string, sizeof(parsed_string), 0);
|
||||
SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next);
|
||||
retval = split_and_pass_pretag_buckets(bb, ctx, f->next);
|
||||
if (retval != APR_SUCCESS) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (include_cgi(parsed_string, r, f->next, head_ptr, inserted_head) == -1) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
|
||||
"invalid CGI ref \"%s\" in %s", tag_val, file);
|
||||
|
Reference in New Issue
Block a user