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 request.c
Date Fri, 09 Nov 2001 16:54:00 GMT
wrowe       01/11/09 08:54:00

  Modified:    server   request.c
  Log:
    Stat, don't lstat the final target.  This means we may double-stat the
    final target file if check for symlinks reveals it's an APR_LNK, but this
    is preferable to the convoluted code required to 'reuse' the original stat.
  
  Revision  Changes    Path
  1.82      +8 -15     httpd-2.0/server/request.c
  
  Index: request.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/request.c,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- request.c	2001/11/09 08:08:42	1.81
  +++ request.c	2001/11/09 16:54:00	1.82
  @@ -504,8 +504,8 @@
        * types of failure, such as APR_ENOTDIR.  We can do something
        * with APR_ENOENT, knowing that the path is good.
        */
  -    if (!r->finfo.filetype) {
  -        apr_lstat(&r->finfo, r->filename, APR_FINFO_MIN, r->pool);
  +    if (!r->finfo.filetype || r->finfo.filetype == APR_LNK) {
  +        apr_stat(&r->finfo, r->filename, APR_FINFO_MIN, r->pool);
       }
   
       if (r->finfo.filetype == APR_REG) {
  @@ -844,21 +844,13 @@
                       && (strncmp(r->filename, 
                                   r->canonical_filename, filename_len) == 0))
   #endif
  -                && ((opts & (OPT_SYM_OWNER | OPT_SYM_LINKS)) == OPT_SYM_LINKS))
{
  +                && ((opts & (OPT_SYM_OWNER | OPT_SYM_LINKS)) == OPT_SYM_LINKS))

  +            {
  +
                   thisinfo.filetype = APR_DIR;
                   ++seg;
                   continue;
               }
  -                
  -            /* XXX: Optimization required:
  -             * If...we have allowed symlinks, and
  -             * if...we find the segment exists in the directory list
  -             * skip the lstat and dummy up an APR_DIR value for thisinfo
  -             * this means case sensitive platforms go quite quickly.
  -             * Case insensitive platforms might be given the wrong path,
  -             * but if it's not found in the cache, then we know we have
  -             * something to test (the misspelling is never cached.)
  -             */
   
               /* We choose apr_lstat here, rather that apr_stat, so that we
                * capture this path object rather than its target.  We will
  @@ -890,7 +882,8 @@
                                 "access to %s failed", r->uri);
                   return r->status = HTTP_FORBIDDEN;
               }
  -            else if ((res = check_safe_file(r))) {
  +
  +            if ((res = check_safe_file(r))) {
                   r->status = res;
                   return res;
               }
  @@ -939,7 +932,7 @@
           /* If we have _not_ optimized, this is the time to recover
            * the final stat result.
            */
  -        if (!r->finfo.filetype) {
  +        if (!r->finfo.filetype || r->finfo.filetype == APR_LNK) {
               r->finfo = thisinfo;
           }
   
  
  
  

Mime
View raw message