From 0926cec5b98218131ac822e1684f9bce7aa0072c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= Date: Thu, 5 Dec 2013 13:19:16 +0100 Subject: [PATCH 14/15] 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 543516ef19e288556e39e61b400a628c94e2817b..c27416899e30b3cf8b3c0496adb08089f4b2c11d 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; -- 1.8.4.2