httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/server core.c
Date Sat, 20 Oct 2001 18:29:09 GMT
wrowe       01/10/20 11:29:09

  Modified:    server   core.c
  Log:
    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 '/'.
  
  Revision  Changes    Path
  1.78      +14 -13    httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- core.c	2001/10/19 02:08:44	1.77
  +++ core.c	2001/10/20 18:29:09	1.78
  @@ -1256,21 +1256,22 @@
       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);
  
  
  

Mime
View raw message