You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by je...@apache.org on 2002/02/07 07:29:57 UTC

cvs commit: httpd-2.0/server request.c

jerenkrantz    02/02/06 22:29:57

  Modified:    .        CHANGES
               server   request.c
  Log:
  Fix resolve_symlink to save the original symlink name if known.
  
  We would previously receive APR_INCOMPLETE on symlinks if wanted has
  FINFO_NAME set because it isn't supported via apr_stat().  Furthermore, we
  don't care what the real name is anyway (even if it apr_stat returned
  .name) - we want to call it by the name the symlink says it is.
  
  Revision  Changes    Path
  1.568     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.567
  retrieving revision 1.568
  diff -u -r1.567 -r1.568
  --- CHANGES	6 Feb 2002 16:58:36 -0000	1.567
  +++ CHANGES	7 Feb 2002 06:29:57 -0000	1.568
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.32-dev
   
  +  *) Fix resolve_symlink to save the original symlink name if known.
  +     [Justin Erenkrantz]
  +
     *) Be a bit more sane with regard to CanonicalNames.  If the user has
        specified they want to use the CanonicalName, but they have not
        configured a port with the ServerName, then use the same port that 
  
  
  
  1.98      +15 -2     httpd-2.0/server/request.c
  
  Index: request.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/request.c,v
  retrieving revision 1.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- request.c	27 Jan 2002 07:44:06 -0000	1.97
  +++ request.c	7 Feb 2002 06:29:57 -0000	1.98
  @@ -396,18 +396,27 @@
   {
       apr_finfo_t fi;
       int res;
  +    const char *savename;
   
       if (!(opts & (OPT_SYM_OWNER | OPT_SYM_LINKS))) {
           return HTTP_FORBIDDEN;
       }
   
  +    /* Save the name from the valid bits. */
  +    savename = (lfi->valid & APR_FINFO_NAME) ? lfi->name : NULL;
  +
       if (opts & OPT_SYM_LINKS) {
  -        if ((res = apr_stat(&fi, d, lfi->valid, p)) != APR_SUCCESS) {
  +        if ((res = apr_stat(&fi, d, lfi->valid & ~(APR_FINFO_NAME), 
  +                            p)) != APR_SUCCESS) {
               return HTTP_FORBIDDEN;
           }
   
           /* Give back the target */
           memcpy(lfi, &fi, sizeof(fi));
  +        if (savename) {
  +            lfi->name = savename;
  +            lfi->valid |= APR_FINFO_NAME;
  +        }
           return OK;
       }
   
  @@ -422,7 +431,7 @@
           }
       }
   
  -    if ((res = apr_stat(&fi, d, lfi->valid, p)) != APR_SUCCESS) {
  +    if ((res = apr_stat(&fi, d, lfi->valid & ~(APR_FINFO_NAME), p)) != APR_SUCCESS) {
           return HTTP_FORBIDDEN;
       }
   
  @@ -432,6 +441,10 @@
   
       /* Give back the target */
       memcpy(lfi, &fi, sizeof(fi));
  +    if (savename) {
  +        lfi->name = savename;
  +        lfi->valid |= APR_FINFO_NAME;
  +    }
       return OK;
   }