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, 15 Feb 2001 04:31:49 GMT
wrowe       01/02/14 20:31:49

  Modified:    .        STATUS
               src      CHANGES
               src/modules/standard mod_userdir.c
  Log:
    *) mod_user on Win32 bug introduced in 1.3.17 is corrected.  The parsing
       is completely rewritten so all platforms share the same file/redirect
       logic interpreting UserDir directives.  Specifying a Win32 or Netware
       relative path or a relative path on any platform using an '*' now
       emits an error when httpd.conf is first parsed.  [William Rowe]
  
  Revision  Changes    Path
  1.915     +5 -12     apache-1.3/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/apache-1.3/STATUS,v
  retrieving revision 1.914
  retrieving revision 1.915
  diff -u -r1.914 -r1.915
  --- STATUS	2001/02/13 22:26:07	1.914
  +++ STATUS	2001/02/15 04:31:47	1.915
  @@ -1,13 +1,12 @@
     1.3 STATUS:
  -  Last modified at [$Date: 2001/02/13 22:26:07 $]
  +  Last modified at [$Date: 2001/02/15 04:31:47 $]
   
   Release:
   
  -    1.3.18-dev: Jim proposes to t/r around Feb 4, 2001.
  -            As such, he also proposes a code freeze.
  +    1.3.18-dev: Target t/r date Feb 1?, 2001, rel date Feb ??.
  +            As such, Jim offers to t/r, proposes a code freeze.
       1.3.17: Tagged and rolled late Jan 26, 2001
  -            To be Announced/Released Jan 29, 2001.
  -            Jim offers to be RM. We are in code freeze
  +            announced Jan 29, 2001.
       1.3.16: Tagged and Rolled Jan 20, 2001.
               Not released because of vhosting bug.
       1.3.15: Not released. Pulled due to CVS dumping core during the
  @@ -33,15 +32,9 @@
       1.3.1: Tagged and rolled on July 19. Announced and released.
       1.3.0: Tagged and rolled on June 1.  Announced and released on the 6th.
              
  -    2.0  : In pre-alpha development, see apache-2.0 repository
  +    2.0  : In pre-alpha development, see httpd-2.0 repository
   
   RELEASE SHOWSTOPPERS:
  -
  -    PR7211 reports 1.3.17 has continuing mod_userdir bogosity.  Expect
  -    the observation that we needed to test the first arg (x), instead of 
  -    the remainder (userdir) for absolute path was correct.
  -    See updated patch posted Mon, 12 Feb 2001 01:11:01 -0600
  -     ID <00e101c094c2$f56531f0$95c0b0d0@roweclan.net> 
   
       Martin observed a core dump because a ipaddr_chain struct contains
       a NULL-"server" pointer when being dereferenced by invoking "httpd -S".
  
  
  
  1.1646    +6 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1645
  retrieving revision 1.1646
  diff -u -r1.1645 -r1.1646
  --- CHANGES	2001/02/14 09:54:44	1.1645
  +++ CHANGES	2001/02/15 04:31:48	1.1646
  @@ -1,5 +1,11 @@
   Changes with Apache 1.3.18
   
  +  *) mod_user on Win32 bug introduced in 1.3.17 is corrected.  The parsing
  +     is completely rewritten so all platforms share the same file/redirect
  +     logic interpreting UserDir directives.  Specifying a Win32 or Netware
  +     relative path or a relative path on any platform using an '*' now
  +     emits an error when httpd.conf is first parsed.  [William Rowe]
  +
     *) Apache/Win32 no longer holds open the console on error, except if
        the internal -w flag is specified as a shortcut argument.  Corrected
        bug that -t test config didn't hold the console open on "SYNTAX OK".
  
  
  
  1.49      +59 -26    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.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- mod_userdir.c	2001/01/25 22:59:36	1.48
  +++ mod_userdir.c	2001/02/15 04:31:48	1.49
  @@ -169,6 +169,15 @@
            * If the first (only?) value isn't one of our keywords, just copy
            * the string to the userdir string.
            */
  +        if (!ap_os_is_path_absolute(arg) && !strchr(arg, ':'))
  +#if defined(WIN32) || defined(NETWARE)
  +            return "UserDir must specify an absolute redirect or absolute "
  +                   "file path";
  +#else
  +            if (strchr(arg, '*'))
  +                 return "UserDir cannot specify a both a relative path and "
  +                        "'*' substitution";
  +#endif
           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.
  @@ -207,7 +216,6 @@
       const char *userdirs = s_cfg->userdir;
       const char *w, *dname;
       char *redirect;
  -    char *x = NULL;
       struct stat statbuf;
   
       /*
  @@ -266,43 +274,68 @@
       while (*userdirs) {
           const char *userdir = ap_getword_conf(r->pool, &userdirs);
           char *filename = NULL;
  -#if defined(NETWARE) || defined(HAVE_DRIVE_LETTERS)
           int is_absolute = ap_os_is_path_absolute(userdir);
  -#endif		
  -
  -        if (strchr(userdir, '*'))
  -            x = ap_getword(r->pool, &userdir, '*');
   
  -	if (userdir[0] == '\0' || userdir[0] == '/') {
  -            if (x) {
  -#if defined(NETWARE) || defined(HAVE_DRIVE_LETTERS)
  -                if (strchr(x, ':') && !is_absolute )
  -#else /* !(NETWARE || HAVE_DRIVE_LETTERS) */
  -                if (strchr(x, ':'))
  -#endif
  -		{
  -                    redirect = ap_pstrcat(r->pool, x, w, userdir, dname, NULL);
  -                    ap_table_setn(r->headers_out, "Location", redirect);
  -                    return REDIRECT;
  -                }
  -                else
  -                    filename = ap_pstrcat(r->pool, x, w, userdir, NULL);
  +        if (strchr(userdir, '*')) {
  +            /* token '*' embedded:
  +             */
  +            char *x = ap_getword(r->pool, &userdir, '*');
  +            if (is_absolute) {
  +                /* token '*' within absolute path
  +                 * serves [UserDir arg-pre*][user][UserDir arg-post*]
  +                 * /somepath/ * /somedir + /~smith -> /somepath/smith/somedir
  +                 */
  +                filename = ap_pstrcat(r->pool, x, w, userdir, NULL);
  +            }
  +            else if (strchr(x, ':')) {
  +                /* token '*' within a redirect path
  +                 * serves [UserDir arg-pre*][user][UserDir arg-post*]
  +                 * http://server/user/ * + /~smith/foo -> http://server/user/smith/foo
  +                 */
  +                redirect = ap_pstrcat(r->pool, x, w, userdir, dname, NULL);
  +                ap_table_setn(r->headers_out, "Location", redirect);
  +                return REDIRECT;
               }
  +            else {
  +                /* Not a redirect, not an absolute path, '*' token:
  +                 * serves [homedir]/[UserDir arg]
  +                 * something/ * /public_html
  +                 * Shouldn't happen, we trap for this in set_user_dir
  +                 */
  +                return DECLINED;
  +            }
  +        }
  +        else if (is_absolute) {
  +            /* An absolute path, no * token:
  +             * serves [UserDir arg]/[user]
  +             * /home + /~smith -> /home/smith
  +             */
  +            if (userdir[strlen(userdir) - 1] == '/')
  +                filename = ap_pstrcat(r->pool, userdir, w, NULL);
               else
                   filename = ap_pstrcat(r->pool, userdir, "/", w, NULL);
           }
  -#if defined(NETWARE) || defined(HAVE_DRIVE_LETTERS)
  -        else if (strchr(userdir, ':') && !is_absolute ) {
  -#else /* !(NETWARE || HAVE_DRIVE_LETTERS) */
           else if (strchr(userdir, ':')) {
  -#endif
  -            redirect = ap_pstrcat(r->pool, userdir, "/", w, dname, NULL);
  +            /* A redirect, not an absolute path, no * token:
  +             * serves [UserDir arg]/[user][dname]
  +             * http://server/ + /~smith/foo -> http://server/smith/foo
  +             */
  +            if (userdir[strlen(userdir) - 1] == '/')
  +                redirect = ap_pstrcat(r->pool, userdir, w, dname, NULL);
  +            else
  +                redirect = ap_pstrcat(r->pool, userdir, "/", w, dname, NULL);
               ap_table_setn(r->headers_out, "Location", redirect);
               return REDIRECT;
           }
           else {
  +            /* Not a redirect, not an absolute path, no * token:
  +             * serves [homedir]/[UserDir arg]
  +             * e.g. /~smith -> /home/smith/public_html
  +             */
   #if defined(WIN32) || defined(NETWARE)
  -            /* Need to figure out home dirs on NT and NetWare */
  +            /* Need to figure out home dirs on NT and NetWare 
  +             * Shouldn't happen here, though, we trap for this in set_user_dir
  +             */
               return DECLINED;
   #else                           /* WIN32 & NetWare */
               struct passwd *pw;
  
  
  

Mime
View raw message