summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-05-17 21:51:09 -0400
committerJakub Hrozek <jhrozek@redhat.com>2013-05-28 15:11:32 +0200
commit7a5a121ae04e3609628855b8383a5d74d405a70d (patch)
tree347817b3c621779f5bd4e8e1a34ba63ebb112c1c
parent61e7adac8b45b7f9139e8a566af9a457a3079271 (diff)
downloadsssd-7a5a121ae04e3609628855b8383a5d74d405a70d.tar.gz
sssd-7a5a121ae04e3609628855b8383a5d74d405a70d.tar.bz2
sssd-7a5a121ae04e3609628855b8383a5d74d405a70d.zip
FO: Fix setting status of duplicates
-rw-r--r--src/providers/fail_over.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index c30ead2b..81fc45ce 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -650,7 +650,8 @@ static bool fo_server_match(struct fo_server *server,
return true;
}
- if (name != NULL && server->common != NULL) {
+ if (name != NULL &&
+ server->common != NULL && server->common->name != NULL) {
if (!strcasecmp(name, server->common->name))
return true;
}
@@ -658,6 +659,17 @@ static bool fo_server_match(struct fo_server *server,
return false;
}
+static bool fo_server_cmp(struct fo_server *s1, struct fo_server *s2)
+{
+ char *name = NULL;
+
+ if (s2->common != NULL) {
+ name = s2->common->name;
+ }
+
+ return fo_server_match(s1, name, s2->port, s2->user_data);
+}
+
static bool fo_server_exists(struct fo_server *list,
const char *name,
int port,
@@ -1371,14 +1383,11 @@ fo_set_port_status(struct fo_server *server, enum port_status status)
* 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)));
+ if (fo_server_cmp(siter, server)) {
+ DEBUG(SSSDBG_TRACE_FUNC,
+ ("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);
}