apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Leffler <jonathan.leff...@gmail.com>
Subject Re: apr symbolic link resolving
Date Mon, 31 Jan 2011 23:43:01 GMT
At the Unix level, you use the readlink() function - very carefully since it
does not null-terminate the string it returns.
In the APR interface, ... it is not clear that there are APR wrapper
functions to cover this.

On Mon, Jan 31, 2011 at 15:33, Tim Traver <tt-list@simplenet.com> wrote:

> Hi all,
> ok, I'm in the process of writing an apache httpd module, and have been
> looking through the docs for apr functions, as I want to use what I have
> available to me, rather than include outside system sources.
> When I do a stat on a symbolic link, I need to be able to see the links
> target path, and I can't seem to figure out how to get that.
> For instance, for a link that might look like this:
> /links/dude.domain.com -> /home/sites/volume03/site/htdocs
> When I do the apr_stat on the /link/dude.domain.com link, it appears I
> get all the stat info on the link itself, but how do I read the
> destination path from the structure?
> Here's an example of how I'm using the code :
> apr_finfo_t pathstat;
> char *path;
> path = "/links/dude.domain.com";
> apr_stat(&pathstat,path,APR_FINFO_LINK,r->pool);
> Then, I am trying to look at the data fields returned like
> pathstat.fname, and pathstat.name, but I'm not getting the path of the
> destination, only the original path to the link.
> I tried using different parameters like APR_FINFO_NAME, or
> I can't figure out how to get the path to the target...
> If it matters, I'm using the latest 2.2.17 httpd, which I believe uses
> the 1.4 branch of the apr libraries, and I am on FreeBSD.
> any help would be appreciated!
> Thanks,
> Tim.

Jonathan Leffler <jonathan.leffler@gmail.com>  #include <disclaimer.h>
Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be

View raw message