httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: [PATCH - Showstopper] 1.3.17-dev mod_userdir
Date Thu, 25 Jan 2001 17:16:48 GMT
From: "Brad Nicholes" <BNICHOLES@novell.com>
Sent: Thursday, January 25, 2001 10:15 AM
>

>Bill,
>     I've run into a problem with your proposed fix for userdir.  I am looking at 
>it now and will get back to you on the details.

Please try this small change to the patch.  I was correct about partial canonicalization
confusing the parser, so maybe this will help all the 'non-unix' platforms;

Index: 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
--- mod_userdir.c 2001/01/15 17:05:51 1.44
+++ mod_userdir.c 2001/01/25 17:15:29
@@ -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;
     }
     /*
@@ -257,26 +266,21 @@
     while (*userdirs) {
         const char *userdir = ap_getword_conf(r->pool, &userdirs);
         char *filename = NULL;
+        char *url_test;
 
         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)
+                /* Need to figure out whether we have been redirected to a URL 
+                 * or to a file on some drive.  While C://foo (or sys://foo) is
+                 * a wordy way of specifying foo from the volume root, we will
+                 * assume that's -not- what the user ment.  So any :// pattern
+                 * is assumed to be a URL.  Effective across platforms.
                  */
-                if (strchr(x + 2, ':'))
-#else
-                if (strchr(x, ':'))
-#endif /* def HAVE_DRIVE_LETTERS */
-  {
+                if ((url_test = strchr(x, ':')) 
+                        && !strncmp(url_test, "://", 3)) {
                     redirect = ap_pstrcat(r->pool, x, w, userdir, dname, NULL);
                     ap_table_setn(r->headers_out, "Location", redirect);
                     return REDIRECT;
@@ -287,7 +291,8 @@
             else
                 filename = ap_pstrcat(r->pool, userdir, "/", w, NULL);
         }
-        else if (strchr(userdir, ':')) {
+        else if ((url_test = strchr(userdir, ':')) 
+                    && !strncmp(url_test, "://", 3)) {
             redirect = ap_pstrcat(r->pool, userdir, "/", w, dname, NULL);
             ap_table_setn(r->headers_out, "Location", redirect);
             return REDIRECT;
@@ -296,7 +301,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



Mime
View raw message