Commit 837ff2cb authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

  Canonicalize all absolute <Directory > sections, not simply those that
  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
parent 6a1c5bf7
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -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) 
    else if (!strcmp(cmd->path, "/") == 0) 
    {
        char *newpath;
	    /* Ensure that the pathname is canonical */
	/*
         * 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);