From 394f8a24f5794bced737cfb743fe038fb4d0f4a6 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 11 Jan 2012 12:03:09 -0500 Subject: LDAP: Copy URI instead of pointing at failover service record In a heavy load environment, sometimes the failover service record would be updated and free the URI value. We need to guarantee that this URI string remains valid throughout the entire request. https://fedorahosted.org/sssd/ticket/1139 --- src/providers/ldap/sdap_async_connection.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c index e1099a17d..ca1cd6e12 100644 --- a/src/providers/ldap/sdap_async_connection.c +++ b/src/providers/ldap/sdap_async_connection.c @@ -100,8 +100,14 @@ struct tevent_req *sdap_connect_send(TALLOC_CTX *memctx, state->ev = ev; state->opts = opts; - state->uri = uri; state->use_start_tls = use_start_tls; + + state->uri = talloc_asprintf(state, "%s", uri); + if (!state->uri) { + talloc_zfree(req); + return NULL; + } + state->sh = sdap_handle_create(state); if (!state->sh) { talloc_zfree(req); @@ -113,7 +119,7 @@ struct tevent_req *sdap_connect_send(TALLOC_CTX *memctx, timeout = dp_opt_get_int(state->opts->basic, SDAP_NETWORK_TIMEOUT); - subreq = sss_ldap_init_send(state, ev, uri, sockaddr, + subreq = sss_ldap_init_send(state, ev, state->uri, sockaddr, sizeof(struct sockaddr_storage), timeout); if (subreq == NULL) { -- cgit