]> granicus.if.org Git - apache/commitdiff
When loading wildcards that are part of a path, only consider directories
authorGraham Leggett <minfrin@apache.org>
Mon, 1 Mar 2010 21:34:51 +0000 (21:34 +0000)
committerGraham Leggett <minfrin@apache.org>
Mon, 1 Mar 2010 21:34:51 +0000 (21:34 +0000)
and ignore other files. [Dan Poirier, Graham Leggett]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@917735 13f79535-47bb-0310-9956-ffa450edef68

server/config.c

index 140612749904ba1323b3511ccba3b24ac21c68be..d073adae9a777384c35805ad38fe8f604b6deb58 100644 (file)
@@ -1542,7 +1542,7 @@ static const char *process_command_config(server_rec *s,
 }
 
 typedef struct {
-    char *fname;
+    const char *fname;
 } fnames;
 
 static int fname_alphasort(const void *fn1, const void *fn2)
@@ -1710,8 +1710,15 @@ static const char *process_resource_config_fnmatch(server_rec *s,
             && strcmp(dirent.name, "..")
             && (apr_fnmatch(fname, dirent.name,
                             APR_FNM_PERIOD) == APR_SUCCESS)) {
+            const char *full_path = ap_make_full_path(ptemp, path, dirent.name);
+            /* If matching internal to path, and we happen to match something
+             * other than a directory, skip it
+             */
+            if (rest && (rv == APR_SUCCESS) && (dirent.filetype != APR_DIR)) {
+                continue;
+            }
             fnew = (fnames *) apr_array_push(candidates);
-            fnew->fname = ap_make_full_path(ptemp, path, dirent.name);
+            fnew->fname = full_path;
         }
     }