Links and samba
lsy at roundtable.cif.rochester.edu
Sun Nov 12 19:22:13 GMT 2000
Urban Widmark wrote:
> On Sat, 11 Nov 2000, Marcin Kuzmicki wrote:
>> I have a problem with smbclient. Is there a possibility of detecting
>> if a file shared by linux box is a vaild directory or only a link.
>> I have a scanner for our academic network that scanns all shares but
>> when it finds a symlink for a parent directory its going round and
>> round and makes my database bigger and bigger.
>> I've tried to check in source files i only found something like
>> uint16 ( i think it describes shares attributes ).
>> Have anyone had such problem or maybe you can help me resolving this
> The problem is that smb does not have symlinks. A samba server will map a
> symlink pointing to a directory into a directory (possibly configurable),
> so to the client there is no way of knowing if the dir is real or not.
> Maybe there is some unique information returned about a directory that
> would allow keeping track of duplicates. But I don't know any such
Here is the script I sent to Marcin:
@name = split '/', $ARGV;
for($i = scalar @name / 2; i >= 0; i--)
$head = join '/', @name[0..$i];
$ARGV =~ /$head.*$head/ and die "Oh no! A loop! Probably."
Another way to do it would be to assume that any file with exactly the same
name, size, flags, and times was a duplicate, but that would involve
checking the database for each file, slowing things down.
More information about the samba