From 5861a17042d1dfb9ae77a519b7e0da9484c2074c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 18 Oct 2007 03:32:07 +0200 Subject: r25692: fixed another example where the free of fde and the free of the socket causes the fd to be closed before epoll is told (This used to be commit d19686cf8a3aba0c6601c5fa58cbf74461055c1c) --- source4/libcli/ldap/ldap_client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4') 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); -- cgit