From 7b12bfc7fe4f2b1a074f6818638c77b949d4acd9 Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Sat, 22 Apr 2023 18:10:30 +0000 Subject: core: Restore original regex value when nesting Location, Directory and File directives. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909356 13f79535-47bb-0310-9956-ffa450edef68 --- server/core.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/core.c b/server/core.c index 4c4715c684..7c9b250b7f 100644 --- a/server/core.c +++ b/server/core.c @@ -2513,6 +2513,7 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg) const char *endp = ap_strrchr_c(arg, '>'); int old_overrides = cmd->override; char *old_path = cmd->path; + ap_regex_t *old_regex = cmd->regex; core_dir_config *conf; ap_conf_vector_t *new_dir_conf = ap_create_per_dir_config(cmd->pool); const command_rec *thiscmd = cmd->cmd; @@ -2556,6 +2557,8 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg) int run_mode = ap_state_query(AP_SQ_RUN_MODE); char *newpath; + cmd->regex = NULL; + /* * Ensure that the pathname is canonical, and append the trailing / */ @@ -2614,6 +2617,7 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg) cmd->path = old_path; cmd->override = old_overrides; + cmd->regex = old_regex; return NULL; } @@ -2624,6 +2628,7 @@ static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg) const char *endp = ap_strrchr_c(arg, '>'); int old_overrides = cmd->override; char *old_path = cmd->path; + ap_regex_t *old_regex = cmd->regex; core_dir_config *conf; const command_rec *thiscmd = cmd->cmd; ap_conf_vector_t *new_url_conf = ap_create_per_dir_config(cmd->pool); @@ -2658,6 +2663,9 @@ static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg) return "Regex could not be compiled"; } } + else { + cmd->regex = NULL; + } /* initialize our config and fetch it */ conf = ap_set_config_vectors(cmd->server, new_url_conf, cmd->path, @@ -2685,6 +2693,7 @@ static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg) cmd->path = old_path; cmd->override = old_overrides; + cmd->regex = old_regex; return NULL; } @@ -2695,6 +2704,7 @@ static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg) const char *endp = ap_strrchr_c(arg, '>'); int old_overrides = cmd->override; char *old_path = cmd->path; + ap_regex_t *old_regex = cmd->regex; core_dir_config *conf; const command_rec *thiscmd = cmd->cmd; ap_conf_vector_t *new_file_conf = ap_create_per_dir_config(cmd->pool); @@ -2736,6 +2746,9 @@ static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg) } else { char *newpath; + + cmd->regex = NULL; + /* Ensure that the pathname is canonical, but we * can't test the case/aliases without a fixed path */ if (apr_filepath_merge(&newpath, "", cmd->path, @@ -2771,6 +2784,7 @@ static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg) cmd->path = old_path; cmd->override = old_overrides; + cmd->regex = old_regex; return NULL; } -- cgit v1.2.1