prevent infinite loop with recurse option enabled?
Justin Yackoski
justin at skiingyac.com
Mon Nov 5 14:49:11 GMT 2001
I am creating a web-based gui to provide searching of files shared via
SMB on a local network. It goes through and finds each computer, its
shares, and its files using smbclient. Currently, a nasty (and
incredibly slow) set of loops in php recurses the directories on each
share using a smbclient call for each directory up to a set depth.
I know for a fact of several computers on my LAN with links/shortcuts
that would lead to infinite recursion if no depth limit or other
measure was used to prevent this. I've tried smbclient's recurse
option, which is of course *much* faster, but it unfortunately follows
the links for as long as I've allowed it to run.
Is there any current way to set a depth limit, or even better, just
simply prevent visiting a directory twice (I've heard that wget hashes
the directory contents and then compares them upon each new directory
to prevent recursion at all...) ?? Any help would be *greatly*
appreciated. I am not opposed to coding something into smbclient
myself, I actually prefer doing that instead of doing it outside of
smbclient. If nothing is currently available, pointers/suggestions
would be great & I will try to put something together for all to
benefit...
Thanks
Justin
More information about the samba
mailing list