You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Tim Traver <tt...@simplenet.com> on 2011/02/01 00:33:26 UTC
apr symbolic link resolving
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 APR_FINFO_TYPE...
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.
Re: apr symbolic link resolving
Posted by Tim Traver <tt...@simplenet.com>.
On 1/31/2011 3:43 PM, Jonathan Leffler wrote:
> 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.
>
>
Jonathan,
Thanks for replying...yeah, I'm familiar with the readlink() function,
and had previously used it, but I was trying to not have to include more
than I needed to if the APR functions had something that would work...
That seems like an omission from the apr_stat command...
Tim
Re: apr symbolic link resolving
Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 1/31/2011 5:43 PM, Jonathan Leffler wrote:
> 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.
I don't think there is, and this would be a great addition to 2.0/trunk.
Re: apr symbolic link resolving
Posted by Jonathan Leffler <jo...@gmail.com>.
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...@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
> APR_FINFO_TYPE...
>
> 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 <jo...@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
amused."