Index: mod_cgi.c =================================================================== --- mod_cgi.c (revision 159030) +++ mod_cgi.c (working copy) @@ -419,7 +419,7 @@ e_info->err_pipe)) != APR_SUCCESS) || ((rc = apr_procattr_dir_set(procattr, ap_make_dirstr_parent(r->pool, - r->filename))) != APR_SUCCESS) || + command))) != APR_SUCCESS) || #ifdef RLIMIT_CPU ((rc = apr_procattr_limit_set(procattr, APR_LIMIT_CPU, conf->limit_cpu)) != APR_SUCCESS) || @@ -1124,6 +1124,8 @@ char *file = r->filename; apr_bucket *tmp_buck; char parsed_string[MAX_STRING_LEN]; + char *cmdpath = NULL; + apr_status_t rv; *inserted_head = NULL; if (ctx->flags & FLAG_PRINTING) { @@ -1146,7 +1148,22 @@ if (!strcmp(tag, "cmd")) { cgi_pfn_ps(r, ctx, tag_val, parsed_string, sizeof(parsed_string), 1); - if (include_cmd(ctx, bb, parsed_string, r, f) == -1) { + if (ap_os_is_path_absolute(r->pool, parsed_string)) { + cmdpath = apr_pstrdup(r->pool, parsed_string); + } + else { + if ((rv = apr_filepath_merge(&cmdpath, + ap_make_dirstr_parent(r->pool, r->filename), + parsed_string, APR_FILEPATH_NOTRELATIVE, + r->pool)) != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "could not determine absolute " + "pathname for %s", parsed_string); + CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, + *inserted_head); + } + } + if (include_cmd(ctx, bb, cmdpath, r, f) == -1) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "execution failure for parameter \"%s\" " "to tag exec in file %s", tag, r->filename);