diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2011-08-15 17:46:04 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-08-15 15:21:18 -0400 |
commit | 5bf2314b9f64099cd4e88b8f3498d986d97e1ac6 (patch) | |
tree | e9b1aa6f15b09b6da395438cf2711ed7db0ad3fa /src/providers/ldap | |
parent | 0e27817133b931dcbe9d196e9ed0d737164ba613 (diff) | |
download | sssd-5bf2314b9f64099cd4e88b8f3498d986d97e1ac6.tar.gz sssd-5bf2314b9f64099cd4e88b8f3498d986d97e1ac6.tar.bz2 sssd-5bf2314b9f64099cd4e88b8f3498d986d97e1ac6.zip |
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.
Diffstat (limited to 'src/providers/ldap')
-rw-r--r-- | src/providers/ldap/sdap_async_connection.c | 6 |
1 files changed, 5 insertions, 1 deletions
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")); |