Minor improvement to libsmbclient.c
jappel at linux01.gwdg.de
Mon Dec 9 00:21:01 GMT 2002
-----BEGIN PGP SIGNED MESSAGE-----
I was working on a little project using libsmclient when i discovered
I wrote a little program listing the directory contents in "smb://" with
smbc_opendir to display a list of all workgroups.
Ususally this works quite well. But if some time passes between
subsequent opendir("smb://") calls, the LMB might have restarted or
Libsmbclient has a clever way to reuse existing connections via
smbc_server() but this causes problems in this case. After a restart of
the LMB the connection from that I got the list of Workgroups the first
time, gets disconnected, but smbc_server() does not yet know about
this. It constantly offers me the same dead connection instead of
creating a new one.
I discovered, that in smbc_close() a similar problem must have been
tackled by calling smbc_remove_unused_server(srv) to try to remove the
dead connection from the list of connections in case of an error.
Though I am not fully aware how this would help if the connection is
used by more than 1 open file/dir, it seemed to me, that
calling smbc_remove_unused_server() after an error has happened in
Adding this line prior the "return -1;" in each
cli_NetServerEnum-Failiure-Branch made my error disappear. What Do you
think? Should this go into the main branch? Or is there a better way to
tell libsmbclient to try to reestablish a dead connection?
Perhaps make smbc_server() check the validity of a connection each time
it returns one?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
-----END PGP SIGNATURE-----
More information about the samba-technical