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 [PATCH - Showstopper] 1.3.17-dev mod_userdir
Date Thu, 25 Jan 2001 15:19:37 GMT
> > > I thoroughly dislike using scattering ifdefs through the module like this.
> > > May I ask... what is keeping us from correcting the ap_os_path_is_absolute
> > > function to distinguish between SYS:/path and HTTP://path?
> 
> Folks,
> 
>   This is the crux of the netware problem.  I'm considering the following
> solution that eliminates the whole host of issues for netware in a very
> clean and simple way.
> 
>   The test for a protocol is that the path is PROTO://something.  Yet we have
> always assumed the colon alone is sufficient.  Is it?  Let us assume, for the
> moment, that someone hacked unix to accept machine:/path/file access to serve
> content from a server farm.  This gotcha awaits.
> 
>   If noone sees any issue with adopting a single test for a redirect, that the
> redirect path includes a "://" sequence, then this patch solves it across the
> board.
> 
>   The caviat that remains is that we need to change the docs to note that on
> Win32, Unix and others, while v://users/*/public_http might be valid way to
> type the pathname, it is not acceptable to mod_userdir.

First... I noticed the subject wasn't very clear, so excuse the reposting.

Second... sorry for the missing { at the end of the line: else if ((url_test = ...

Third... Please review carefully, comment, and let's get this showstopper outa here!

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 14:40:02
@@ -257,25 +257,20 @@
     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);
@@ -287,7 +282,7 @@
             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 +291,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