httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: [PATCH - Showstopper] 1.3.17-dev mod_userdir
Date Thu, 25 Jan 2001 20:05:05 GMT
This looks like the same as previously, except for the additions
with the defined(WIN32) || ... stuff. Is that right?

> 
> Index: modules/standard/mod_userdir.c
> ===================================================================
> RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_userdir.c,v
> retrieving revision 1.44
> diff -u -r1.44 mod_userdir.c
> --- modules/standard/mod_userdir.c 2001/01/15 17:05:51 1.44
> +++ modules/standard/mod_userdir.c 2001/01/25 17:59:56
> @@ -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;
>      }
>      /*
> @@ -261,22 +270,9 @@
>          if (strchr(userdir, '*'))
>              x = ap_getword(r->pool, &userdir, '*');
>  
> - if (userdir[0] == '\0' || ap_os_is_path_absolute(userdir)) {
> + if (userdir[0] == '\0' || userdir[0] == '/') {
>              if (x) {
> -#ifdef 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 (strchr(x, ':'))
> -#endif /* def HAVE_DRIVE_LETTERS */
> -  {
> +                if (ap_is_url(x)) {
>                      redirect = ap_pstrcat(r->pool, x, w, userdir, dname, NULL);
>                      ap_table_setn(r->headers_out, "Location", redirect);
>                      return REDIRECT;
> @@ -287,7 +283,7 @@
>              else
>                  filename = ap_pstrcat(r->pool, userdir, "/", w, NULL);
>          }
> -        else if (strchr(userdir, ':')) {
> +        else if (ap_is_url(userdir)) {
>              redirect = ap_pstrcat(r->pool, userdir, "/", w, dname, NULL);
>              ap_table_setn(r->headers_out, "Location", redirect);
>              return REDIRECT;
> @@ -296,7 +292,7 @@
>  #if defined(WIN32) || defined(NETWARE)
>              /* Need to figure out home dirs on NT and NetWare */
>              return DECLINED;
> -#else                           /* WIN32 & NetWare */
> +#else /* !(WIN32 || NETWARE) */
>              struct passwd *pw;
>              if ((pw = getpwnam(w))) {
>  #ifdef OS2
> Index: main/util.c
> ===================================================================
> RCS file: /home/cvs/apache-1.3/src/main/util.c,v
> retrieving revision 1.193
> diff -u -r1.193 util.c
> --- main/util.c 2001/01/15 17:05:05 1.193
> +++ main/util.c 2001/01/25 17:59:59
> @@ -1723,6 +1723,22 @@
>   }
>      }
>  
> +#if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE)
> +    /* Netware, OS2 and Win32 have an additional headache, that the file paths
> +     * look like potential URI's.  Therefore, these platforms further restrict
> +     * this test to comply with RFC2396 3.2. Authority Component.  The standard
> +     * suggests this scheme applies for absolute references to globally unique 
> +     * and persistent entities.  In that sense, a mailto: or news: URL doesn't
> +     * constitute any persistent resource that Apache will 'redirect' into.
> +     *
> +     * This test alone may be insufficient based on the context, since the
> +     * v://foo is a legitimate reference to the foo member in the root of v.
> +     * However, we assume here that that is not what the user intended.
> +     */
> +    if (u[x] && (u[x + 1] != '/' || u[x + 2] != '/'))
> +        return 0;
> +#endif
> +
>      return (x ? 1 : 0);  /* If the first character is ':', it's broken, too */
>  }
>  
> 
> 


-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
          "Casanova will have many weapons; To beat him you will
              have to have more than forks and flatulence."

Mime
View raw message