httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <>
Subject Re: translate_userdir()
Date Mon, 18 Mar 1996 16:47:04 GMT
On Mon, 18 Mar 1996, Jim Jagielski wrote:

> 	  /*
> 	   * Ok. Let's get this straight. At this point we know
> 	   * that the getpwnam() call failed. Why? Because the user
> 	   * doesn't exist. This must mean that no matter what, we'll
> 	   * never find the right filename. We should return NOT_FOUND.
> 	   * We don't wait until we stat() because filename at this
> 	   * point is NULL.
> 	   */

Not true. (not NULL, the first part) If I use the followin UserDir statement:

UserDir public_html /usr/www

Let's say we get a request for ~bob, and user bob doesn't exist but 
/usr/www/bob does? Now, we could do a check to see if it's the last 
entry, and return NOT_FOUND here if so...

>       /*
>        * At last entry? What does this mean? It means
>        * that we've exhausted the list in UserDir. It
>        * also means that, as seen from the above, that
>        * the stat() of filename failed, or else we
>        * wouldn't be here... No more possible choices
>        * or permutations and the filename we think
>        * we want, we can't stat(). Doesn't this sound
>        * like a file-not-found condition? Shouldn't
>        * we return that?
>        */

Nope. Because...

UserDir /foo/script.cgi

In this case, if I call ~bob, /foo/script.cgi/bob does not exist, so you 
need to pass it on to the rest of the request process.

Here's what might work as an if statement:

if ((filename != NULL) && (!*userdirs || (stat(filename, &r->finfo) != -1)))

That way it will pass onto the next entry if the filename is null, 
without sending OK or statting, which seems to be causing your problem. 
If it doesn't find anything, it'll end up sending the DECLINED at the end 
of the loop, which is the proper thing to do in this case (since it 
allows other modules to pick up the request if we can't find it). And it 
works with CGI scripts as the last entry.

--// Alexei Kosut // <> // Lefler on IRC --//
-----------------// <> -------// 
"To get the full effect of Pat Buchanan's speeches, they should be
read in the original German." //--------------------------------------

View raw message