From 0926cec5b98218131ac822e1684f9bce7aa0072c Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Thu, 5 Dec 2013 13:19:16 +0100 Subject: failover: check dns_domain if primary servers lookup failed If primary servers lookup failed, dns_domain is not set. Resolves: https://fedorahosted.org/sssd/ticket/2173 --- src/providers/fail_over_srv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/providers/fail_over_srv.c b/src/providers/fail_over_srv.c index 543516ef1..c27416899 100644 --- a/src/providers/fail_over_srv.c +++ b/src/providers/fail_over_srv.c @@ -302,13 +302,17 @@ static void fo_discover_servers_primary_done(struct tevent_req *subreq) } if (state->backup_domain == NULL) { + /* if there is no backup domain, we are done */ DEBUG(SSSDBG_TRACE_FUNC, ("No backup domain specified\n")); goto done; } - if (strcasecmp(state->dns_domain, state->backup_domain) == 0) { - /* primary domain was unreachable, we will use servers from backup - * domain as primary */ + if (state->dns_domain != NULL + && strcasecmp(state->dns_domain, state->backup_domain) == 0) { + /* If there was no error and dns_domain is the same as backup domain, + * it means that we were unable to resolve SRV in primary domain, but + * SRV from backup domain was resolved and those servers are considered + * to be primary. We are done. */ state->backup_servers = NULL; state->num_backup_servers = 0; -- cgit