]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Canonicalize all absolute <Directory > sections, not simply those that
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sat, 20 Oct 2001 18:29:09 +0000 (18:29 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sat, 20 Oct 2001 18:29:09 +0000 (18:29 +0000)
  fail to end in a '/'.  Slash test is afterwords, once we've canonicalized
  any '\' and other aliases to '/'.

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

server/core.c

index a7cd374fe3fcb21044b32befd864b3fc8abf32a0..53cfbc26f2143e027c99a1b0b5ae60df641994e1 100644 (file)
@@ -1256,21 +1256,22 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
     else if (thiscmd->cmd_data) { /* <DirectoryMatch> */
        r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
     }
-    else if (cmd->path[strlen(cmd->path) - 1] != '/') {
-        cmd->path = apr_pstrcat(cmd->pool, cmd->path, "/", NULL);
-
-        if (!strcmp(cmd->path, "/") == 0) 
-        {
-            char *newpath;
-           /* Ensure that the pathname is canonical */
-            if (apr_filepath_merge(&newpath, NULL, cmd->path, 
-                                   APR_FILEPATH_TRUENAME, cmd->pool) != APR_SUCCESS) {
-                return apr_pstrcat(cmd->pool, "<Directory \"", cmd->path,
-                                   "\"> path is invalid.", NULL);
-            }
-            cmd->path = newpath;
+    else if (!strcmp(cmd->path, "/") == 0) 
+    {
+        char *newpath;
+       /*
+         * Ensure that the pathname is canonical, and append the trailing /
+         */
+        if (apr_filepath_merge(&newpath, NULL, cmd->path, 
+                               APR_FILEPATH_TRUENAME, cmd->pool) != APR_SUCCESS) {
+            return apr_pstrcat(cmd->pool, "<Directory \"", cmd->path,
+                               "\"> path is invalid.", NULL);
         }
+        cmd->path = newpath;
+        if (cmd->path[strlen(cmd->path) - 1] != '/')
+            cmd->path = apr_pstrcat(cmd->pool, cmd->path, "/", NULL);
     }
+
     /* initialize our config and fetch it */
     conf = ap_set_config_vectors(cmd->server, new_dir_conf, cmd->path,
                                  &core_module, cmd->pool);