summaryrefslogtreecommitdiff
path: root/source4/libcli/ldap
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli/ldap')
-rw-r--r--source4/libcli/ldap/ldap_client.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c
index aea95de161..fcb2d92214 100644
--- a/source4/libcli/ldap/ldap_client.c
+++ b/source4/libcli/ldap/ldap_client.c
@@ -366,12 +366,14 @@ static void ldap_connect_got_sock(struct composite_context *ctx, struct ldap_con
/* setup a handler for events on this socket */
conn->event.fde = event_add_fd(conn->event.event_ctx, conn->sock,
socket_get_fd(conn->sock),
- EVENT_FD_READ, ldap_io_handler, conn);
+ EVENT_FD_READ | EVENT_FD_AUTOCLOSE, ldap_io_handler, conn);
if (conn->event.fde == NULL) {
composite_error(ctx, NT_STATUS_INTERNAL_ERROR);
return;
}
+ socket_set_flags(conn->sock, SOCKET_FLAG_NOCLOSE);
+
talloc_steal(conn, conn->sock);
if (conn->ldaps) {
struct socket_context *tls_socket = tls_init_client(conn->sock, conn->event.fde);