From 89092f50fdb980d33ebc9064a0a29d62f957d3b4 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(-) diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c index 58e5a0f6c..88dea1456 100644 --- a/src/providers/ldap/sdap_async_connection.c +++ b/src/providers/ldap/sdap_async_connection.c @@ -99,8 +99,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); @@ -110,7 +116,7 @@ struct tevent_req *sdap_connect_send(TALLOC_CTX *memctx, state->sh->page_size = dp_opt_get_int(state->opts->basic, SDAP_PAGE_SIZE); - subreq = sss_ldap_init_send(state, ev, uri, sockaddr, + subreq = sss_ldap_init_send(state, ev, state->uri, sockaddr, sizeof(struct sockaddr_storage)); if (subreq == NULL) { ret = ENOMEM; -- cgit