summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2012-01-11 12:03:09 -0500
committerStephen Gallagher <sgallagh@redhat.com>2012-01-17 09:36:07 -0500
commit89092f50fdb980d33ebc9064a0a29d62f957d3b4 (patch)
treeae08b6e4957aaafe87615b9d891f7ce082cc91a9
parent5bbd5779210bbdbe8b911b8a6361e1a2737dcdb7 (diff)
downloadsssd-89092f50fdb980d33ebc9064a0a29d62f957d3b4.tar.gz
sssd-89092f50fdb980d33ebc9064a0a29d62f957d3b4.tar.xz
sssd-89092f50fdb980d33ebc9064a0a29d62f957d3b4.zip
LDAP: Copy URI instead of pointing at failover service recordsssd-1.5.1-66.el6_2.2
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
-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 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;