summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/sdap_async_connection.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-08-15 17:46:04 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-12-13 08:40:08 -0500
commit48d1565a58de4ca58b36aef2ae65392ac97d16e8 (patch)
treef6107dc70d15859c7627e1635d577bccd7739bcb /src/providers/ldap/sdap_async_connection.c
parent8f9336b0e7e13d4d133555cc98d46a28397d82e4 (diff)
downloadsssd-48d1565a58de4ca58b36aef2ae65392ac97d16e8.tar.gz
sssd-48d1565a58de4ca58b36aef2ae65392ac97d16e8.tar.xz
sssd-48d1565a58de4ca58b36aef2ae65392ac97d16e8.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/sdap_async_connection.c')
-rw-r--r--src/providers/ldap/sdap_async_connection.c6
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 58e5a0f6c..7bce2cdf8 100644
--- a/src/providers/ldap/sdap_async_connection.c
+++ b/src/providers/ldap/sdap_async_connection.c
@@ -87,6 +87,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;
@@ -110,8 +111,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"));