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:22:04 -0400 |
commit | bba376bff88042bb04ac89e9b3167ae89c57a953 (patch) | |
tree | a41cd139d10e4a7d49493e68e0d95f4df2185b0e /src/providers | |
parent | 194a6c52d21ff7881d6d685aa21c0a7076e8f3c7 (diff) | |
download | sssd_unused-bba376bff88042bb04ac89e9b3167ae89c57a953.tar.gz sssd_unused-bba376bff88042bb04ac89e9b3167ae89c57a953.tar.xz sssd_unused-bba376bff88042bb04ac89e9b3167ae89c57a953.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')
-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 9d543ec1..10f5ab4e 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")); |