summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-10-18 03:32:07 +0200
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:43:16 +0100
commit5861a17042d1dfb9ae77a519b7e0da9484c2074c (patch)
treec07183575dff173569e2dad82f6c1a6031550c4d
parent62078f17bad197780c8cc4e501dd1655bd809edc (diff)
downloadsamba-5861a17042d1dfb9ae77a519b7e0da9484c2074c.tar.gz
samba-5861a17042d1dfb9ae77a519b7e0da9484c2074c.tar.bz2
samba-5861a17042d1dfb9ae77a519b7e0da9484c2074c.zip
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)
-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);