summaryrefslogtreecommitdiff
path: root/src/providers
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-06-18 12:59:45 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-06-21 10:00:38 +0200
commitd12a07608a321f211a74643df7db9bcef76e2ca6 (patch)
treeda5d3920c012180f591441212ff9d6db7c046fc6 /src/providers
parente5f455afbc2d149527bfd08f4e89903a3a8da17a (diff)
downloadsssd-d12a07608a321f211a74643df7db9bcef76e2ca6.tar.gz
sssd-d12a07608a321f211a74643df7db9bcef76e2ca6.tar.bz2
sssd-d12a07608a321f211a74643df7db9bcef76e2ca6.zip
collapse_srv_lookup may free the server, make it clear from the API
https://fedorahosted.org/sssd/ticket/1947
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/fail_over.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index c5db7024..46caaea4 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -216,10 +216,11 @@ int fo_is_srv_lookup(struct fo_server *s)
}
static struct fo_server *
-collapse_srv_lookup(struct fo_server *server)
+collapse_srv_lookup(struct fo_server **_server)
{
- struct fo_server *tmp, *meta;
+ struct fo_server *tmp, *meta, *server;
+ server = *_server;
meta = server->srv_data->meta;
DEBUG(4, ("Need to refresh SRV lookup for domain %s\n",
meta->srv_data->dns_domain));
@@ -252,6 +253,8 @@ collapse_srv_lookup(struct fo_server *server)
meta->srv_data->srv_lookup_status = SRV_NEUTRAL;
meta->srv_data->last_status_change.tv_sec = 0;
+ *_server = NULL;
+
return meta;
}
@@ -1189,7 +1192,7 @@ resolve_srv_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
str_srv_data_status(status)));
switch(status) {
case SRV_EXPIRED: /* Need a refresh */
- state->meta = collapse_srv_lookup(server);
+ state->meta = collapse_srv_lookup(&server);
/* FALLTHROUGH.
* "server" might be invalid now if the SRV
* query collapsed
@@ -1202,9 +1205,9 @@ resolve_srv_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
}
subreq = ctx->srv_send_fn(state, ev,
- server->srv_data->srv,
- server->srv_data->proto,
- server->srv_data->discovery_domain,
+ state->meta->srv_data->srv,
+ state->meta->srv_data->proto,
+ state->meta->srv_data->discovery_domain,
ctx->srv_pvt);
if (subreq == NULL) {
ret = ENOMEM;