r25692: fixed another example where the free of fde and the free of the socket
authorAndrew Tridgell <tridge@samba.org>
Thu, 18 Oct 2007 01:32:07 +0000 (03:32 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:43:16 +0000 (05:43 +0100)
causes the fd to be closed before epoll is told

source/libcli/ldap/ldap_client.c

index aea95de161b0ce6c9ffb8b686cd2c4ba89fbe115..fcb2d922148b106d8c608dd74ca21f0f007d128d 100644 (file)
@@ -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);