Minor improvement to libsmbclient.c
Jürgen Appel
jappel at linux01.gwdg.de
Mon Dec 9 00:21:01 GMT 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi.
I was working on a little project using libsmclient when i discovered
something odd:
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
even changed.
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
smbc_opendir.
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?
Greetings
Jürgen
- --
GPG key:
http://pgp.mit.edu:11371/pks/lookup?search=J%FCrgen+Appel&op=get
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAj3z4bEACgkQ7h8HhBg+h9WIrQCgpIvZF2XO1z4EsobFRsdE7C9x
t34AnA1rZr9r3aSLu21kF2KgMUSSRVnC
=+u38
-----END PGP SIGNATURE-----
More information about the samba-technical
mailing list