summaryrefslogtreecommitdiff
path: root/src/providers/ldap/sdap_async_connection.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2012-01-11 12:03:09 -0500
committerStephen Gallagher <sgallagh@redhat.com>2012-01-14 11:53:29 -0500
commit394f8a24f5794bced737cfb743fe038fb4d0f4a6 (patch)
tree7ee082603d19f1d806f486973fe05e34c0fc5720 /src/providers/ldap/sdap_async_connection.c
parent23d17a0389386c09b72dba31bac5f586c904f113 (diff)
downloadsssd-394f8a24f5794bced737cfb743fe038fb4d0f4a6.tar.gz
sssd-394f8a24f5794bced737cfb743fe038fb4d0f4a6.tar.bz2
sssd-394f8a24f5794bced737cfb743fe038fb4d0f4a6.zip
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
Diffstat (limited to 'src/providers/ldap/sdap_async_connection.c')
-rw-r--r--src/providers/ldap/sdap_async_connection.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c
index e1099a17..ca1cd6e1 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) {