diff options
author | Jeff Trawick <trawick@apache.org> | 2000-08-05 01:22:57 +0200 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2000-08-05 01:22:57 +0200 |
commit | 127fc591629406d5c9bd002cbde226539f7fa071 (patch) | |
tree | 39bab8b54a6b300a7e2834baeb33e8b02dd06dc9 /server/config.c | |
parent | Fix a small typo (diff) | |
download | apache2-127fc591629406d5c9bd002cbde226539f7fa071.tar.xz apache2-127fc591629406d5c9bd002cbde226539f7fa071.zip |
Fix a config tree problem.
The following configuration file demonstrates the problem:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteMap quux-map prg:/tmp/apache-2.0/map.quux.pl
RewriteRule ^/~quux/(.*)$ /~quux/${quux-map:$1}
</IfModule>
After this config file is parsed, the only statement in the config
tree is the last statement in the IfModule container ("RewriteRule blah
blah").
The problem is that when ap_build_config_sub() handles this type of
construct, it moves *current to the end of the list before returning.
If this construct were the first thing in the file, the caller would
set conftree to *current, not realizing that there were list elements
before *current. The caller doesn't have addressability to those list
elements.
With this change, ap_build_config_sub() sets *conftree before
walking *current to the end of the list.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85993 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | server/config.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/server/config.c b/server/config.c index ddeb13ca40..acf6548235 100644 --- a/server/config.c +++ b/server/config.c @@ -843,7 +843,8 @@ static const char *execute_now(char *cmd_line, const char *args, cmd_parms *parm static const char * ap_build_config_sub(apr_pool_t *p, apr_pool_t *temp_pool, const char *l, cmd_parms *parms, ap_directive_t **current, - ap_directive_t **curr_parent) + ap_directive_t **curr_parent, + ap_directive_t **conftree) { const char *args; char *cmd_name; @@ -894,6 +895,12 @@ static const char * ap_build_config_sub(apr_pool_t *p, apr_pool_t *temp_pool, } } if (*current) { + if (!*conftree) { + /* Before walking *current to the end of the list, + * set the head to *current. + */ + *conftree = *current; + } while ((*current)->next != NULL) { (*current) = (*current)->next; (*current)->parent = (*curr_parent); @@ -959,7 +966,7 @@ const char * ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool, break; } retval = ap_build_config_sub(p, temp_pool, l, parms, current, - curr_parent); + curr_parent, &conftree); if (retval != NULL) return retval; if (conftree == NULL && curr_parent != NULL) { @@ -1060,7 +1067,7 @@ API_EXPORT(const char *) ap_build_config(cmd_parms *parms, while (!(ap_cfg_getline(l, MAX_STRING_LEN, parms->config_file))) { errmsg = ap_build_config_sub(p, temp_pool, l, parms, - ¤t, &curr_parent); + ¤t, &curr_parent, conftree); if (errmsg != NULL) return errmsg; |