]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1635428 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 2 Dec 2014 12:43:23 +0000 (12:43 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 2 Dec 2014 12:43:23 +0000 (12:43 +0000)
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

STATUS
include/http_core.h
server/core.c
server/request.c

diff --git a/STATUS b/STATUS
index cdfbb0bf72b324546f6823a5a9f7b1da4e148946..ffbffeeca9cfc5ac0b50bb3f4e12aed16ad9b6b1 100644 (file)
--- 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:
index 5cef6224fc6fa530b728621a5c83c5c2db3c2183..4a39d96c49518e03512249e1709aa719c6f6167d 100644 (file)
@@ -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 <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 */
 
index 613ffa40447c4f75f81cf631734c08ad208ae5cd..9c2443baa6fe963e26eb6dfda327d161f1e7cb0f 100644 (file)
@@ -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 *));
index af0a697a9f42b4e41d3eb1a47b3308cdda4bcd66..8d660e2817e0b51eb2021255f941068e08360e76 100644 (file)
@@ -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;
             }