From 184ae8079ce7f8ecf3b472f180309e3108897aad Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 28 Nov 2012 12:53:39 +0100 Subject: [PATCH] BUG 9436: Fix leaking sockets of SMB connections to a DC. As this is a burst of 3 unbound sockets with each try to reach a DC we're running out of file descriptors pretty fast. So winbind is then mostly spinning in an accept loop failing with EMFILE. Signed-off-by: Andreas Schneider Reviewed-by: Jim McDonough Autobuild-User(master): Jim McDonough Autobuild-Date(master): Wed Nov 28 17:17:21 CET 2012 on sn-devel-104 (cherry picked from commit 1106ca59eea9fe5d95a1098c84f77c9e6108659f) --- source3/winbindd/winbindd_cm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index d129e1f61c7..9a02789360e 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -1602,6 +1602,10 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain, result = cm_prepare_connection(domain, fd, domain->dcname, &new_conn->cli, &retry); + if (!NT_STATUS_IS_OK(result)) { + /* Don't leak the smb connection socket */ + close(fd); + } if (!retry) break; -- 2.11.4.GIT