Bug report by Julien Cristau <julien.cristau@ens-lyon.org> in Debian BTS: Package: libsmbclient Version: 3.0.20b-2 Severity: normal Tags: patch Hi when connecting to netbios shares, libsmbclient tries to cache connections. smbc_server thus calls find_server to avoid creating multiple connections with the same parameters. The problem is that if find_server fails, and the subsequent call to cli_session_setup (at libsmb/libsmbclient.c:715) fails too, it then tries to open a connection with username = "". If this connection succeeds, it is cached, but the username value of the cache entry is "", and the connection is never reused, because every call to smbc_server (and thus to find_server) uses the original username. I think that there should either be a call to find_server(context, server, share, workgroup, username_used, password) after username_used has been set to "", or the connection should be cached with the original username (which is what the attached patch does).
Created attachment 1576 [details] Patch proposed by the bug submitter
I looked at both patch options. I agree with your choice. Patch applied. Thanks.