symlink failure when listing a dircetory in samba 3.0.25

Jeremy Allison jra at
Fri May 11 22:23:22 GMT 2007

On Fri, May 11, 2007 at 02:33:48PM -0400, Neal A. Lucier wrote:
> I think that filtering is the wrong conclusion to the fact that
> you are unable to guess the possible type and or status of the
> target of a symlink.  My argument and subsequent example have to do
> with just standard ugo UNIX permissions and might not apply in
> Posix.1e, NTFS, NFSv4, or other ACL regimes.  I'm not a programmer
> or an SMB/NTFS guru by any means.
> User 'nlucier' makes symlinks to files and directories in /root,
> neither or which can be stated by the creator of the symlink or
> anyone who stats the symlink; however, the symlink itself is
> created with permiscous permissions and anyone can tell what
> that it is a symlink and what its target is, and if they also
> have abilites to stat the target then they can further determine
> if the target is a directory or a file.
> In terms of icon choice in explorer.exe, it seems you need to
> express three states; 1) symlink can stat target, target is dir
> 2) symlink can stat target, target is file 3) symlink can't
> stat target.  You could overload either the stat AND dir or
> stat AND file icon to also symbolize no stat of target.
> Can't stat target example; "dir" is a directory symlink and "file"
> is a file symlink (but since we can't stat who really knows?).
> % ln -s /root/file file
> % ln -s /root/dir/ dir/
> % ls -l file
> lrwxrwxrwx   1 nlucier  cstaff        10 May 11 14:20 file -> /root/file
> % ls -l dir
> lrwxrwxrwx   1 nlucier  cstaff         9 May 11 14:20 dir -> /root/dir
> Can stat target example; ls intelligently recognizes and informs the
> user if the target is a file or a directory.
> % ln -s /etc/passwd file
> % ln -s /etc/init.d/ dir/
> % ls -l file
> lrwxrwxrwx   1 nlucier  cstaff        11 May 11 14:26 file -> /etc/passwd
> % ls -l dir
> lrwxrwxrwx   1 nlucier  cstaff        11 May 11 14:26 dir -> /etc/init.d/
> How this actually maps into how new Windows symlinks work I have no clue.
> But as a user (and an admin) I would like to be able to create and
> see symlinks that point to nowhere on both *nix and samba/windows
> shares and partitions.

Then use the Linux CIFSFS client that understands symlinks and
will report them (and create them) in exactly the same way as
a local filesystem.

It's only a Windows client that can't see these things, as we
can't know what they map to. The codepath in question is only
taken when doing a Windows qfileinfo - on a UNIX qfileinfo
we correctly return a symlink.


More information about the samba-technical mailing list