Links and samba
Samuel Hathaway
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:
>
>>
>> Hi,
>> 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
>> problem.
>
> 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
> information.
>
> /Urban
Here is the script I sent to Marcin:
@name = split '/', $ARGV[0];
for($i = scalar @name / 2; i >= 0; i--)
{
$head = join '/', @name[0..$i];
$ARGV[0] =~ /$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.
-samuel
More information about the samba
mailing list