symlink failure when listing a dircetory in samba 3.0.25

Neal A. Lucier nlucier at math.purdue.edu
Fri May 11 18:33:48 GMT 2007


Jeremy Allison wrote:
 > On Fri, May 11, 2007 at 10:40:08AM -0500, Gerald (Jerry) Carter wrote:
 >
 >>-----BEGIN PGP SIGNED MESSAGE-----
 >>Hash: SHA1
 >>
 >>Jeremy,
 >>
 >>Is this a change in behavior ?
 >>
 >>* create a symlink in a share to a directory that
 >>  has permissions that would deny a given user to
 >>  stat the link target
 >>
 >>* smbd removes the link from the list of files
 >>  in the output to smbclient and Windows 2003
 >>
[stuff snipped as I don't really understand it]
 >>
 >>It seems to be that we should display the link anyways.
 >>Hide unreadable is not set.
 >
 >
 > Actually this isn't a change in behavior I think.
 >
 > What should we display if we can't stat a symlink target ?
 > Is is a link to a directory ? Is it a link to a file ?
 >
 > We don't know and can't guess - whatever we guess it'll be
 > wrong. I think we just have to filter it.
 >

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.

Neal


More information about the samba-technical mailing list