From f34efab902fb9c13e080f213570692a1c7e9c1ed Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 14 Aug 2015 12:54:00 +0200 Subject: [PATCH] s3:lib: fix some corner cases of open_socket_out_cleanup() In case of timeouts we retry the async_connect_send() and forgot to remember it, this results in an abort() in async_connect_cleanup() as the fd is already closed when calling fcntl(F_SETFL). BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider Reviewed-by: Volker Lendecke (cherry picked from commit ce3c77fb45ccf4d45a0fa655325e30e748d89245) --- source3/lib/util_sock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index d865ffb..3a66da1 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -680,6 +680,7 @@ static void open_socket_out_connected(struct tevent_req *subreq) tevent_req_nterror(req, NT_STATUS_NO_MEMORY); return; } + state->connect_subreq = subreq; tevent_req_set_callback(subreq, open_socket_out_connected, req); return; } @@ -702,10 +703,12 @@ NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd) NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { + tevent_req_received(req); return status; } *pfd = state->fd; state->fd = -1; + tevent_req_received(req); return NT_STATUS_OK; } -- 1.9.1