apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: apr_realpath
Date Wed, 14 Mar 2001 21:20:34 GMT
From: "Kevin Pilch-Bisson" <kevin@pilch-bisson.net>
Sent: Wednesday, March 14, 2001 11:39 AM

> Sorry, I think it has to do with the way mutt handles pgp signing
> messages.  I'm not going to sign this one, so hopefully it won't do so.
> Offhand, which pathetic win32 client.

Message is fine, I'm using MeSsed Outlook Express (which actually, usually handles
pgp signed messages, as opposed to the MS Office Outlook).  

> > apr_status_t apr_filepath_root(char** pathroot, char** name, apr_pool_t *p)
> >     Which returns the canonical form of the pathroot and returns the first non-root
> >     part of name (e.g. '/foo' is '/' 'foo' on unix, 'c:\foo' is 'c:\' 'foo' and
> >     '//machine/share/foo' is '//machine/share/' 'foo' on win32)
> >     Handles incomplete roots ('c:foo' on win32 is 'c:', 'foo', but returns a status
> >     of APR_EINCOMPLETE).
> Would there be a way to convert an incomplete path to a complete path?
> (change drive to c:, getpwd, append foo, in the above example)

That is what apr_filepath_merge does for you.  You can pass a partial root [/ or d:]
apr_filepath_root over to apr_filepath_merge as the addpath (with a null root).  That
will return a true root.  apr_filepath_root is as much to help apr_filepath_merge
(and any other app) break apart the root from a name, since the root is very platform
specific (moreso than any other part of this debate.)  Look at netware machine/sys:/
versus win32/os2, toss in unc names and unix remote volumes and ugh, what a mess.

> > apr_status_t apr_filepath_common(char** result, char* a, char* b, apr_pool_t *p)
> >     returns the segments that match, comparing from the beginning.
> >     The user must canonicalize the paths first with apr_filepath_merge.
> >     /foo/bar compared to /foo/barstool  returns  /foo/
> >     compare does not distinguish between '/' and '\' on win32/os2 - they compare
> >     If a and b were char**, we could point at the first uncommon element, but a
> >     of result provides the same answer, no?  [This isn't true of the above example
> >     is changing the case, eliminating trailing '.'s and ' 's from win32 names, and

> >     converting short aliases to true names).
> > 
> > Canonicalizing first to the truename is required before apr_filepath_common can
> > trusted on Win32 or OS2, since c:/thislongname/ is also c:/THISLO~1/
> Canonicalizing is done by apr_filepath_merge, with NULL rootpath, right?

Yes, or by merging the untrusted path onto a known canonical path (say a ServerRoot or
DocumentRoot already canonicalized within Apache's server structure.)

View raw message