[SSSD] [PATCH] Failover: Return last tried server if it's still being tried

Jakub Hrozek jhrozek at redhat.com
Fri Aug 3 11:28:36 UTC 2012


On Thu, Aug 02, 2012 at 11:09:07AM +0200, Pavel Březina wrote:
> On 07/31/2012 07:46 PM, Jakub Hrozek wrote:
> >https://fedorahosted.org/sssd/ticket/1447
> >
> >See the commit message or the ticket description for full explanation.
> 
> Looks good, but can you rebase it please?

Sure, attached.
-------------- next part --------------
>From 86dc094ffafd1b0f5d86ebc926ad3c6e2ac2d967 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Tue, 31 Jul 2012 17:25:35 +0200
Subject: [PATCH] Failover: Return last tried server if it's still being tried

In the failover, we treat both KDC and LDAP on the IPA server as a single
"port", numbered 0. This was done in order to make sure that the SSSD
always talks to the same server for both LDAP and Kerberos.

However, this clever hack breaks when the IPA provider needs to establish an
GSSAPI encrypted LDAP connection because we're asking the fail over code to
yield a server while no server has yet been marked as tried. This triggers a
fail over for the KDC, so in effect, the TGT is received from second server.

If the second server is not available for some reason, the whole provider
goes offline.

The fail over needs to detect that the server asked for is still being
resolved and return the same pointer.
---
 src/providers/fail_over.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index 002d6d578f2790664f1682e33338403a6d509b95..7fed7cce181b83b5b219a27673dc6e1e0ef415e4 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -75,7 +75,7 @@ struct fo_server {
     bool primary;
     void *user_data;
     int port;
-    int port_status;
+    enum port_status port_status;
     struct srv_data *srv_data;
     struct fo_service *service;
     struct timeval last_status_change;
@@ -686,12 +686,16 @@ get_first_server_entity(struct fo_service *service, struct fo_server **_server)
      * Otherwise iterate through the server list.
      */
 
-
     /* First, try primary servers after the last one we tried.
      * (only if the last one was primary as well)
      */
     if (service->last_tried_server != NULL &&
         service->last_tried_server->primary) {
+        if (service->last_tried_server->port_status == PORT_NEUTRAL) {
+            server = service->last_tried_server;
+            goto done;
+        }
+
         DLIST_FOR_EACH(server, service->last_tried_server->next) {
             /* Go only through primary servers */
             if (!server->primary) continue;
-- 
1.7.10.4



More information about the sssd-devel mailing list