From 3f4dfb6a43e67cdbe50f43c441fb1961d864bff6 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Sat, 18 Jun 2016 19:30:04 +0200 Subject: [PATCH 2/2] UTIL: Revent connection handling in sssd_async_connect_send Even though the connect() man page says waiting on a non-blocking connect should be done by checking for writability, we need to check also for readability. Otherwise it slightly break offline mode. Changing password in offline mode is not supported by sssd and error message "System is offline, password change not possible" is printed. However without TEVENT_FD_READ for connect it takes much longer when sssd finds out that it cannot connect to a server. It fails after expiration of timeout (6 seconds). But meanwhile "passwd user" finished without logging the offline message. With TEVENT_FD_READ, connect fails much faster with errno 113/No route to host. The change was introduced in the commit e05d3f5872263aadfbc2f6a2a8c9735219922387 --- src/util/sss_sockets.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/sss_sockets.c b/src/util/sss_sockets.c index 67db80850f7a2348900003fe0d0244de46fcfc25..85eb9e23aa37234ed3cf2781114f55d559d7baec 100644 --- a/src/util/sss_sockets.c +++ b/src/util/sss_sockets.c @@ -142,7 +142,8 @@ struct tevent_req *sssd_async_connect_send(TALLOC_CTX *mem_ctx, switch (ret) { case EINPROGRESS: case EINTR: - state->fde = tevent_add_fd(ev, state, fd, TEVENT_FD_WRITE, + state->fde = tevent_add_fd(ev, state, fd, + TEVENT_FD_READ | TEVENT_FD_WRITE, sssd_async_connect_done, req); if (state->fde == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "tevent_add_fd failed.\n"); -- 2.7.4