From 5bf2314b9f64099cd4e88b8f3498d986d97e1ac6 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 15 Aug 2011 17:46:04 +0200 Subject: Handle timeout during sss_ldap_init_send In some cases, where there would be no response from the LDAP server, there would be no R/W events on the LDAP fd, so sdap_async_sys_connect_done would never be called. This patch adds a tevent timer that cancels the connection after SDAP_NETWORK_TIMEOUT seconds. --- src/providers/ldap/sdap_async_connection.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/providers/ldap/sdap_async_connection.c') diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c index db39be19..6f67700d 100644 --- a/src/providers/ldap/sdap_async_connection.c +++ b/src/providers/ldap/sdap_async_connection.c @@ -89,6 +89,7 @@ struct tevent_req *sdap_connect_send(TALLOC_CTX *memctx, struct tevent_req *subreq; struct sdap_connect_state *state; int ret; + int timeout; req = tevent_req_create(memctx, &state, struct sdap_connect_state); if (!req) return NULL; @@ -112,8 +113,11 @@ struct tevent_req *sdap_connect_send(TALLOC_CTX *memctx, state->sh->page_size = dp_opt_get_int(state->opts->basic, SDAP_PAGE_SIZE); + timeout = dp_opt_get_int(state->opts->basic, SDAP_NETWORK_TIMEOUT); + subreq = sss_ldap_init_send(state, ev, uri, sockaddr, - sizeof(struct sockaddr_storage)); + sizeof(struct sockaddr_storage), + timeout); if (subreq == NULL) { ret = ENOMEM; DEBUG(1, ("sss_ldap_init_send failed.\n")); -- cgit