You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Bill Stoddard <st...@raleigh.ibm.com> on 2000/03/14 19:16:54 UTC

WebDAV and ap_os_canonical_filename()

On Apache for Windows and OS/2, ap_os_canonical_filename is used to fold the
absolute filename to all lower case before access protections are checked.
URIs are case sensitive (A_file.html is different from a_file.html in the
general case) but the Win32 file system is not case sensitive (A_file.html
is the same as a_file.html), so it makes sense to fold the filename on
systems that have case insenstive file systems before checking access rules.
No problem with this. However, there are exceptional cases where filename
case needs to be preserved even on systems that have case insensitive (but
case preserving) file systems.

One notable exception is the name of Java class files. The filename must
exactly match, including case, the class name.   So here is the problem....
If I publish a Java class with a mixed case name with a DAV implementation
written to the Apache API, the filename case is not preserved by Apache (on
Windows) and my class will not compile once I fetch it out of the repository
again. We need to preserve filename case on a PUT request. The only solution
that comes to mind is to create a new char* in the request_rec structure
(char* case_canononical_filename ?) that contains the translated filename
that has not been folded to lower case. mod_dav can use this field when
handling PUT requests. Any other ideas?

Bill
________________________________________________
Bill Stoddard stoddard@raleigh.ibm.com


Re: WebDAV and ap_os_canonical_filename()

Posted by Manoj Kasichainula <ma...@io.com>.
On Tue, Mar 14, 2000 at 01:16:54PM -0500, Bill Stoddard wrote:
> The only solution
> that comes to mind is to create a new char* in the request_rec structure
> (char* case_canononical_filename ?) that contains the translated filename
> that has not been folded to lower case. mod_dav can use this field when
> handling PUT requests. Any other ideas?

This was the solution I was about to propose before reading the rest
of your message. I think it should just be called canonical_filename
though; there could be OSes where the canonicalization is unrelated to
case.


Re: WebDAV and ap_os_canonical_filename()

Posted by Eli Marmor <ma...@elmar.co.il>.
> It seems like we need a NoFoldType argument that specifies (case
> insensitive) which extensions are folded and which are not.

Yes, it reminds me a VERY ugly patch I did to support virtual files
(which don't really exist, but the returned content is decided by
decoding their "name"). I inserted something like:

<SORRY, UGLY, PLEASE DON'T FLAME...>

if (!(test_filename = strrchr(r->filename, '.')) || strcasecmp(test_filename, ".b64"))

</SORRY, UGLY, PLEASE DON'T FLAME...>

before the ap_os_canonical_filename() call, at http_request.c (the
"patch" is based on 1.3.12).

Having a special directive, we can replace the strcasecmp() by a loop of
call to strcasecmp(), for each of the NoFoldType extensions, and only if
none matches the extension, call ap_os_canonical_filename().

I suggest to call it "AddNoFoldType", rather than just "NoFoldType".

-- 
Eli Marmor

RE: WebDAV and ap_os_canonical_filename()

Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
Forgive a stupid question?

I presume the java class files have their own .class extension (pure java is
not one of my strong suits)...

It seems like we need a NoFoldType argument that specifies (case
insensitive) which extensions are folded and which are not.

Now you are correct, windows will just cough back up WEBaccess if we set a
nofold on a specific type.  We have two options...

1) under windows - resolve the true name of the file (using FindFirstFile?)
and  deny the request if the case doesn't match.

2) under windows - fold the name to the true name of the file.

And three, all platforms, if the NoFoldType is set, treat the access
permissions as gospel with no folding whatsoever.

Does this make a bit of sense?

Bill


Re: WebDAV and ap_os_canonical_filename()

Posted by Manoj Kasichainula <ma...@io.com>.
On Wed, Mar 15, 2000 at 10:29:09AM -0500, Bill Stoddard wrote:
> The routines are ap_canonical_filename(), which canonicalizes and folds to
> all lower case, and ap_case_canonical_filename() which canonicalizes but
> preserves the case.

I don't quite understand why both are needed, but I haven't been
paying enough attention to the discussion, so don't worry about it.

> The result of
> ap_case_canonical_filename needs to be saved in the request_rec along with
> r->filename (which is canonicalized w/o case preservation) for use by DAV.
> If no one objects, I'll commit a patch to 1.3 and 2.0.

+1


Re: WebDAV and ap_os_canonical_filename()

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
> I know that there is an ap_os_foo_canonical_filename call in Apache that
> preserves case. I also know that APR has always intended to provide two
> canonicla filenames, one in the original case, and one in all lower case.
The routines are ap_canonical_filename(), which canonicalizes and folds to
all lower case, and ap_case_canonical_filename() which canonicalizes but
preserves the case. Both exist in 1.3 and 2.0 today. The result of
ap_case_canonical_filename needs to be saved in the request_rec along with
r->filename (which is canonicalized w/o case preservation) for use by DAV.
If no one objects, I'll commit a patch to 1.3 and 2.0.

Bill


Re: WebDAV and ap_os_canonical_filename()

Posted by Greg Stein <gs...@lyra.org>.
Your suggestion is exactly what Bill suggested from the start :-)

I raised this issue a couple weeks ago when it came up on the WebDAV list,
but people were silent... Glad there is discussion this time around...
hehe..

Cheers,
-g

On Tue, 14 Mar 2000 rbb@apache.org wrote:
> I know that there is an ap_os_foo_canonical_filename call in Apache that
> preserves case. I also know that APR has always intended to provide two
> canonicla filenames, one in the original case, and one in all lower case.
> I know this, because Ken Parzygnat expressed how important this was back
> when I started APR.  If this isn't being done, then it needs to be done.
> In fact, the plan has always been (and I know we aren't currently doing
> this) to provide ap_get_canon_fname and ap_get_lwr_canon_fname.  I
> haven't bothered to implement this yet, but it is so easy, I figured it
> could wait.
> 
> Ryan
> 
> 
> 
> On Tue, 14 Mar 2000, Bill Stoddard wrote:
> 
> > > There is a ap_case_os_canoncical_filename, which preserves case, IIRC.
> > > Or, punt this until 2.0, which correctly handles this case in APR.
> > 
> > Ummm, no I don't think so. Platforms with case insensitive file systems need
> > to be canonicalized to all one case. I don't think APR does anything to help
> > this unless I'm missing something fundamental.
> > 
> > Bill
> > 
> > 
> 
> 
> _______________________________________________________________________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> -------------------------------------------------------------------------------
> 

-- 
Greg Stein, http://www.lyra.org/


Re: WebDAV and ap_os_canonical_filename()

Posted by rb...@apache.org.
I know that there is an ap_os_foo_canonical_filename call in Apache that
preserves case. I also know that APR has always intended to provide two
canonicla filenames, one in the original case, and one in all lower case.
I know this, because Ken Parzygnat expressed how important this was back
when I started APR.  If this isn't being done, then it needs to be done.
In fact, the plan has always been (and I know we aren't currently doing
this) to provide ap_get_canon_fname and ap_get_lwr_canon_fname.  I
haven't bothered to implement this yet, but it is so easy, I figured it
could wait.

Ryan



On Tue, 14 Mar 2000, Bill Stoddard wrote:

> > There is a ap_case_os_canoncical_filename, which preserves case, IIRC.
> > Or, punt this until 2.0, which correctly handles this case in APR.
> 
> Ummm, no I don't think so. Platforms with case insensitive file systems need
> to be canonicalized to all one case. I don't think APR does anything to help
> this unless I'm missing something fundamental.
> 
> Bill
> 
> 


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: WebDAV and ap_os_canonical_filename()

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
> There is a ap_case_os_canoncical_filename, which preserves case, IIRC.
> Or, punt this until 2.0, which correctly handles this case in APR.

Ummm, no I don't think so. Platforms with case insensitive file systems need
to be canonicalized to all one case. I don't think APR does anything to help
this unless I'm missing something fundamental.

Bill


Re: WebDAV and ap_os_canonical_filename()

Posted by rb...@apache.org.
On Tue, 14 Mar 2000, Bill Stoddard wrote:

> On Apache for Windows and OS/2, ap_os_canonical_filename is used to fold the
> absolute filename to all lower case before access protections are checked.
> URIs are case sensitive (A_file.html is different from a_file.html in the
> general case) but the Win32 file system is not case sensitive (A_file.html
> is the same as a_file.html), so it makes sense to fold the filename on
> systems that have case insenstive file systems before checking access rules.
> No problem with this. However, there are exceptional cases where filename
> case needs to be preserved even on systems that have case insensitive (but
> case preserving) file systems.
> 
> One notable exception is the name of Java class files. The filename must
> exactly match, including case, the class name.   So here is the problem....
> If I publish a Java class with a mixed case name with a DAV implementation
> written to the Apache API, the filename case is not preserved by Apache (on
> Windows) and my class will not compile once I fetch it out of the repository
> again. We need to preserve filename case on a PUT request. The only solution
> that comes to mind is to create a new char* in the request_rec structure
> (char* case_canononical_filename ?) that contains the translated filename
> that has not been folded to lower case. mod_dav can use this field when
> handling PUT requests. Any other ideas?

There is a ap_case_os_canoncical_filename, which preserves case, IIRC.
Or, punt this until 2.0, which correctly handles this case in APR.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------