summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-04-11 11:04:07 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-04-15 11:38:07 -0400
commit771127e2d24bbb8f7344840fdfa5936a61209c7e (patch)
treee74950c72619c008981d46926284ddc067fdfdd0 /src
parent3af32f011436727b4c4615b20c0b0913ab7e9e12 (diff)
downloadsssd-771127e2d24bbb8f7344840fdfa5936a61209c7e.tar.gz
sssd-771127e2d24bbb8f7344840fdfa5936a61209c7e.tar.xz
sssd-771127e2d24bbb8f7344840fdfa5936a61209c7e.zip
Set same status for duplicate servers
Diffstat (limited to 'src')
-rw-r--r--src/providers/fail_over.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index 085b1a41d..2e662fb72 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -1311,6 +1311,8 @@ fo_set_server_status(struct fo_server *server, enum server_status status)
void
fo_set_port_status(struct fo_server *server, enum port_status status)
{
+ struct fo_server *siter;
+
DEBUG(4, ("Marking port %d of server '%s' as '%s'\n", server->port,
SERVER_NAME(server), str_port_status(status)));
@@ -1320,6 +1322,25 @@ fo_set_port_status(struct fo_server *server, enum port_status status)
fo_set_server_status(server, SERVER_WORKING);
server->service->active_server = server;
}
+
+ if (!server->common || !server->common->name) return;
+
+ /* It is possible to introduce duplicates when expanding SRV results
+ * into fo_server structures. Find the duplicates and set the same
+ * status */
+ DLIST_FOR_EACH(siter, server->service->server_list) {
+ if (siter == server) continue;
+ if (!siter->common || !siter->common->name) continue;
+
+ if (siter->port == server->port &&
+ (strcasecmp(siter->common->name, server->common->name) == 0)) {
+ DEBUG(7, ("Marking port %d of duplicate server '%s' as '%s'\n",
+ siter->port, SERVER_NAME(siter),
+ str_port_status(status)));
+ siter->port_status = status;
+ gettimeofday(&siter->last_status_change, NULL);
+ }
+ }
}
void fo_try_next_server(struct fo_service *service)