/etc/passwd and symlinks
Denys Vlasenko
vda.linux at googlemail.com
Wed Nov 7 16:46:33 PST 2007
On Wednesday 07 November 2007 21:08, Paul Fox wrote:
> denys wrote:
> >
> > Thus I propose introducing xmalloc_readlink_recursive()
> > which does not suffer from those two problems,
> > and using it here (and elsewhere: insmod, syslogd -
> > grep for xmalloc_readlink).
>
> well, i've written a new version, but it doesn't do what you
> thought it was going to. :-)
>
> realpath() fully canonicalizes a path -- it makes it absolute,
> removes "/..", and expands symlinks all along the path.
>
> readlink() (and also xmalloc_readlink()) simply returns the value
> of the named symlink.
I did understand this difference.
> (which makes the switch from realpath()
> to xmalloc_readlink() somewhat suspicious, by the way.)
?
> i've written xmalloc_readlink_follow(char *path) which iteratively
> does textual expansion of path, expanding symlinks at the tail end
> of path. no other canonicalization is done, and the result is not
> necessarily absolute. this is the minimum needed for my "allow
> /etc/passwd to be a symlink" change, and it's probably useful for
> most of the other current uses of xmalloc_readlink().
Yes. Feel free to fix syslogd's use of xmalloc_readlink() too
(currently it will break if /dev/log is a link to link).
--
vda
More information about the busybox
mailing list