From: Jim Jagielski Date: Tue, 2 Dec 2014 12:43:23 +0000 (+0000) Subject: Merge r1635428 from trunk: X-Git-Tag: 2.4.11~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96f790bcb7f123305b3cf94b55502c18f8a22e05;p=thirdparty%2Fapache%2Fhttpd.git Merge r1635428 from trunk: 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 --- diff --git a/STATUS b/STATUS index cdfbb0bf72b..ffbffeeca9c 100644 --- a/STATUS +++ b/STATUS @@ -104,10 +104,6 @@ RELEASE SHOWSTOPPERS: 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: diff --git a/include/http_core.h b/include/http_core.h index 5cef6224fc6..4a39d96c495 100644 --- a/include/http_core.h +++ b/include/http_core.h @@ -597,6 +597,7 @@ typedef struct { #define AP_CONDITION_ELSE 2 #define AP_CONDITION_ELSEIF (AP_CONDITION_ELSE|AP_CONDITION_IF) unsigned int condition_ifelse : 2; /* is this an , , or */ + unsigned int d_is_directory : 1; /* Whether core_dir_config is Directory* */ ap_expr_info_t *condition; /* Conditionally merge sections */ diff --git a/server/core.c b/server/core.c index 613ffa40447..9c2443baa6f 100644 --- a/server/core.c +++ b/server/core.c @@ -2163,6 +2163,7 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg) 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 *)); diff --git a/server/request.c b/server/request.c index af0a697a9f4..8d660e2817e 100644 --- a/server/request.c +++ b/server/request.c @@ -1212,6 +1212,13 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r) 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; }