From: William A. Rowe Jr Date: Sat, 20 Oct 2001 18:29:09 +0000 (+0000) Subject: Canonicalize all absolute sections, not simply those that X-Git-Tag: 2.0.27~65 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=90cb9e99537f90222a733e672a54f92e9d5e33d5;p=thirdparty%2Fapache%2Fhttpd.git Canonicalize all absolute 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 --- diff --git a/server/core.c b/server/core.c index a7cd374fe3f..53cfbc26f21 100644 --- a/server/core.c +++ b/server/core.c @@ -1256,21 +1256,22 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg) else if (thiscmd->cmd_data) { /* */ 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, "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, "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);