httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject Re: Win32: Why strlwr os_canonical_filename?
Date Fri, 02 Oct 1998 17:04:49 GMT
On Fri, 2 Oct 1998, Ben Laurie wrote:

> Marc Slemko wrote:
> > 
> > On Wed, 30 Sep 1998, Ken Parzygnat wrote:
> > 
> > > I have a question regarding the following code
> > > segment from sub_canonical_filename:
> > >
> > > if (h == INVALID_HANDLE_VALUE) {
> > >     ap_assert(strlen(szCanon) + strlen(szFilePart) + nSlashes < nCanon);
> > >     for (n = 0; n < nSlashes; ++n) {
> > >         strcat(szCanon, "/");
> > >     }
> > >     strcat(szCanon, szFilePart);
> > >     return FALSE;
> > > }
> > > else {
> > >     ap_assert(strlen(szCanon)+strlen(d.cFileName) < nCanon);
> > >     strlwr(d.cFileName);
> > >     strcat(szCanon, d.cFileName);
> > >     return TRUE;
> > > }
> > >
> > > Why is strlwr being called in the else leg?  Can we remove
> > > this call?
> > 
> > Because we need some way to be able to try to compare filenames, for
> > numerous purposes such as access control.
> > 
> > Because, due to the greatness of Win32, there are around 9543 different
> > names for any file, and differing case is one of those ways, we have to
> > lowercase things.
> > 
> > This should, however, only be done on the actual filename part, nothing
> > else.  I seem to remember this being fixed three or four times.
> 
> It is only being done on the actual filename part.

Except that PATH_TRANSLATED is a filename but it isn't a filename.

See PR#mumble, which likely prompted this question.  


Mime
View raw message