httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@worldgate.com>
Subject Re: Win32: Why strlwr os_canonical_filename?
Date Wed, 30 Sep 1998 19:37:42 GMT
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.

Sigh.



Mime
View raw message