httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: [PATCH] workaround for stat problem on RedHat 5.1/5.2
Date Sun, 16 May 1999 20:56:04 GMT
Ed Korthof wrote:
> 
> Hi --
> 
> A JServ user turned some something which appears to be a bug in RedHat's
> stat.  It doesn't show up when mod_rewrite isn't enabled, and it only
> affects URIs for which there is no matching file.
> 
> On RedHat 5.1/5.2, with a file which doesn't exist, stat returns -1, and
> sets errno to ENOENT. Unfortunately, it leaves r->finfo in an inconsistent
> state; r->finfo.st_mode appears to contain garbage (an address of some
> sort, most likely).  Sometimes it leaves r->finfo.st_mode set to a value
> for which all of S_ISDIR(), S_ISLNK(), and S_ISREG() return false;
> sometimes it doesn't (this depends on the text of the program -- if that
> changes, the value will change).  If all of those return false, then
> check_safe_path (in http_request.c) returns 403, and that's the HTTP
> return code.
> 
> This is a problem in general for modules which answer URIs for files which
> doesn't exist, and it's a problem for JServ in particular.  We advise
> people to configure their Apache so that /servlets/foo is transformed into
> a request for the servlet named foo ... where /servlets/ doesn't exist as
> a directory.
> 
> I'm pretty sure this behavior is a bug in glibc's stat; the following
> simple program demonstrates it:

It isn't a bug in stat: the bug is to continue to use finfo after stat
failed.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

Mime
View raw message