From: Eric Covener Date: Fri, 30 Jan 2015 16:58:20 +0000 (+0000) Subject: Provide a way for EXEC_ON_READ directives to see their context X-Git-Tag: 2.5.0-alpha~3498 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2154a9de68745582f49281f28c60e256fb6bf16c;p=apache Provide a way for EXEC_ON_READ directives to see their context (parent directive). Usually, this context is not also EXEC_ON_READ so it's not fully processed, so e.g cmd->path is not fluffed up yet because the closing tag of the section is not read yet and ap_check_cmd_context() doesn't work) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1656058 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 0e991710c3..c6790aba71 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -477,6 +477,7 @@ * core_dir_config * 20140627.10 (2.5.0-dev) Add ap_proxy_de_socketfy to mod_proxy.h * 20150121.0 (2.5.0-dev) Revert field addition from core_dir_config; r1653666 + * 20150121.1 (2.5.0-dev) Add cmd_parms_struct.parent to http_config.h */ #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */ @@ -484,7 +485,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20150121 #endif -#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/http_config.h b/include/http_config.h index da4490c0a4..0dfca50f4f 100644 --- a/include/http_config.h +++ b/include/http_config.h @@ -325,7 +325,10 @@ struct cmd_parms_struct { struct ap_conf_vector_t *context; /** directive with syntax error */ const ap_directive_t *err_directive; - + + /** If the current directive is EXEC_ON_READ, this is the + enclosing directive */ + ap_directive_t *parent; }; /** diff --git a/server/config.c b/server/config.c index 50fa76d98c..d8afca7a34 100644 --- a/server/config.c +++ b/server/config.c @@ -841,7 +841,8 @@ AP_DECLARE(module *) ap_find_linked_module(const char *name) #define AP_MAX_ARGC 64 static const char *invoke_cmd(const command_rec *cmd, cmd_parms *parms, - void *mconfig, const char *args) + void *mconfig, const char *args, + ap_directive_t *parent) { int override_list_ok = 0; char *w, *w2, *w3; @@ -870,6 +871,7 @@ static const char *invoke_cmd(const command_rec *cmd, cmd_parms *parms, parms->info = cmd->cmd_data; parms->cmd = cmd; + parms->parent = parent; switch (cmd->args_how) { case RAW_ARGS: @@ -1306,7 +1308,7 @@ static const char *ap_walk_config_sub(const ap_directive_t *current, continue; } - retval = invoke_cmd(cmd, parms, dir_config, current->args); + retval = invoke_cmd(cmd, parms, dir_config, current->args, NULL); if (retval != NULL && strcmp(retval, DECLINE_CMD) != 0) { /* If the directive in error has already been set, don't @@ -1670,7 +1672,7 @@ static const char *execute_now(char *cmd_line, const char *args, const char *retval; cmd = ml->cmd; - retval = invoke_cmd(cmd, parms, sub_tree, args); + retval = invoke_cmd(cmd, parms, sub_tree, args, parent); if (retval != NULL) { return retval;