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-14 12:00:30 -0500
commit585ffd71e5b97fd9fae396948e1d1360cf6d7b4b (patch)
tree0df2f9806361a09fc4967850906a206d241bdca4
parentdbfc4445311497bc1f1e0276146d37cf3de49096 (diff)
downloadsssd_unused-585ffd71e5b97fd9fae396948e1d1360cf6d7b4b.tar.gz
sssd_unused-585ffd71e5b97fd9fae396948e1d1360cf6d7b4b.tar.xz
sssd_unused-585ffd71e5b97fd9fae396948e1d1360cf6d7b4b.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
-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 e176a709..570d6d49 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) {