httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apache-1.3/src/modules/standard mod_userdir.c
Date Thu, 25 Jan 2001 21:22:29 GMT
wrowe       01/01/25 13:22:28

  Modified:    src      CHANGES
               src/modules/standard mod_userdir.c
  Log:
    Fix one case of win32/os2 failing to accept a UserDir c:/userdir
    argument, close a potential segfault, and accept backslashed UserDir
    path if the admin wasn't paying attention.
  
  Revision  Changes    Path
  1.1628    +4 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1627
  retrieving revision 1.1628
  diff -u -r1.1627 -r1.1628
  --- CHANGES	2001/01/25 21:03:47	1.1627
  +++ CHANGES	2001/01/25 21:22:17	1.1628
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.17
   
  +  *) Fix an unlikely segfault provided a zero length string in the
  +     translate_userdir() call on win32/os2, and accept backslashes
  +     in the UserDir directive on those platforms [William Rowe]
  +
     *) Fixed translate_userdir() in MOD_USERDIR.C so that it correctly
        recognizes NetWare absolute paths.  This fixes the problem where
        MOD_USERDIR was trying to redirect to an absolute NetWare path
  
  
  
  1.46      +18 -9     apache-1.3/src/modules/standard/mod_userdir.c
  
  Index: mod_userdir.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_userdir.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- mod_userdir.c	2001/01/25 21:03:55	1.45
  +++ mod_userdir.c	2001/01/25 21:22:24	1.46
  @@ -170,6 +170,15 @@
            * the string to the userdir string.
            */
           s_cfg->userdir = ap_pstrdup(cmd->pool, arg);
  +#if defined(WIN32) || defined(OS2) || defined(NETWARE)
  +        /* This is an incomplete path, so we cannot canonicalize it yet.
  +         * but any backslashes will confuse the parser, later, so simply
  +         * change them to slash form.
  +         */
  +        arg = s_cfg->userdir;
  +        while (arg = strchr(arg, '\\'))
  +            *(arg++) = '/';
  +#endif
           return NULL;
       }
       /*
  @@ -268,21 +277,17 @@
               if (x) {
   #ifdef NETWARE 
                   if (strchr(x, ':') && !is_absolute )
  -#else
  -#ifdef HAVE_DRIVE_LETTERS
  +#elif defined(HAVE_DRIVE_LETTERS)
                   /*
                    * Crummy hack. Need to figure out whether we have been
                    * redirected to a URL or to a file on some drive. Since I
                    * know of no protocols that are a single letter, if the : is
                    * the second character, I will assume a file was specified
  -                 *
  -                 * Still no good for NETWARE, since : is embedded (sys:/home)
                    */
  -                if (strchr(x + 2, ':'))
  -#else
  +                if ((strlen(x) > 1) && strchr(x + 2, ':'))
  +#else /* !(NETWARE ||HAVE_DRIVE_LETTERS) */
                   if (strchr(x, ':'))
  -#endif /* def HAVE_DRIVE_LETTERS */
  -#endif /* NETWARE */
  +#endif
   		{
                       redirect = ap_pstrcat(r->pool, x, w, userdir, dname, NULL);
                       ap_table_setn(r->headers_out, "Location", redirect);
  @@ -296,7 +301,11 @@
           }
   #ifdef NETWARE
           else if (strchr(userdir, ':') && !is_absolute ) {
  -#else        
  +#elif defined(HAVE_DRIVE_LETTERS)
  +        /* Same Crummy hack here
  +         */
  +        else if ((strlen(userdir) > 1) && strchr(userdir + 2, ':')) {
  +#else /* !(NETWARE ||HAVE_DRIVE_LETTERS) */
           else if (strchr(userdir, ':')) {
   #endif
               redirect = ap_pstrcat(r->pool, userdir, "/", w, dname, NULL);
  
  
  

Mime
View raw message