core: Do not match files when using DirectoryMatch. PR41867.
Submitted by: jkaluza
Reviewed/backported by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@
1642852 13f79535-47bb-0310-9956-
ffa450edef68
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * core: Do not match files when using DirectoryMatch. PR 41867.
- trunk patch: http://svn.apache.org/r1635428
- 2.4.x patch: http://people.apache.org/~jkaluza/patches/httpd-2.4.x-directorymatch.patch
- +1: jkaluza, covener, ylavic
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
#define AP_CONDITION_ELSE 2
#define AP_CONDITION_ELSEIF (AP_CONDITION_ELSE|AP_CONDITION_IF)
unsigned int condition_ifelse : 2; /* is this an <If>, <ElseIf>, or <Else> */
+ unsigned int d_is_directory : 1; /* Whether core_dir_config is Directory* */
ap_expr_info_t *condition; /* Conditionally merge <If> sections */
conf->r = r;
conf->d = cmd->path;
conf->d_is_fnmatch = (apr_fnmatch_test(conf->d) != 0);
+ conf->d_is_directory = 1;
if (r) {
conf->refs = apr_array_make(cmd->pool, 8, sizeof(char *));
pmatch = apr_palloc(rxpool, nmatch*sizeof(ap_regmatch_t));
}
+ /* core_dir_config is Directory*, but the requested file is
+ * not a directory, so although the regexp could match,
+ * we skip it. */
+ if (entry_core->d_is_directory && r->finfo.filetype != APR_DIR) {
+ continue;
+ }
+
if (ap_regexec(entry_core->r, r->filename, nmatch, pmatch, 0)) {
continue;
}