Bug 3267 - libsmbclient: file descriptor leak
Summary: libsmbclient: file descriptor leak
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.0.20b
Hardware: Other Linux
: P3 normal
Target Milestone: none
Assignee: Derrell Lipman
QA Contact: Samba QA Contact
URL: http://bugs.debian.org/339564
Depends on:
Reported: 2005-11-16 23:44 UTC by Christian Perrier
Modified: 2005-12-05 20:44 UTC (History)
0 users

See Also:

Patch proposed by the bug submitter (588 bytes, patch)
2005-11-16 23:44 UTC, Christian Perrier
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Perrier 2005-11-16 23:44:02 UTC
Bug report by Julien Cristau <julien.cristau@ens-lyon.org> in Debian BTS:

Package: libsmbclient
Version: 3.0.20b-2
Severity: normal
Tags: patch


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).
Comment 1 Christian Perrier 2005-11-16 23:44:34 UTC
Created attachment 1576 [details]
Patch proposed by the bug submitter
Comment 2 Derrell Lipman 2005-12-05 20:44:27 UTC
I looked at both patch options.  I agree with your choice.  Patch applied.  Thanks.