From 7534f145c7b376dd5320d7f73022923f087d49a9 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Wed, 23 Oct 2013 18:05:58 +0200 Subject: AD: fall back to LDAP if GC is not available. AD provider went offline if the Global Catalog could not be connected although there was also the LDAP port available. With this patch, AD provider will fall back to the LDAP port before going offline. New boolean flag ignore_mark_offline was added to structure sdap_id_conn_ctx If this flag is enabled function be_mark_offline will not be called. Resolves: https://fedorahosted.org/sssd/ticket/2104 --- src/providers/ldap/ldap_common.h | 2 ++ src/providers/ldap/sdap_id_op.c | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/providers/ldap') diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h index 0d565fc63..fb9a34c60 100644 --- a/src/providers/ldap/ldap_common.h +++ b/src/providers/ldap/ldap_common.h @@ -52,6 +52,8 @@ struct sdap_id_conn_ctx { struct sdap_id_conn_cache *conn_cache; /* dlinklist pointers */ struct sdap_id_conn_ctx *prev, *next; + /* do not go offline, try another connection */ + bool ignore_mark_offline; }; struct sdap_id_ctx { diff --git a/src/providers/ldap/sdap_id_op.c b/src/providers/ldap/sdap_id_op.c index 52cf78569..5e166e19f 100644 --- a/src/providers/ldap/sdap_id_op.c +++ b/src/providers/ldap/sdap_id_op.c @@ -553,10 +553,17 @@ static void sdap_id_op_connect_done(struct tevent_req *subreq) } if (ret != EOK && !can_retry) { - /* be is going offline as there is no more servers to try */ - DEBUG(1, ("Failed to connect, going offline (%d [%s])\n", - ret, strerror(ret))); - be_mark_offline(conn_cache->id_conn->id_ctx->be); + if (conn_cache->id_conn->ignore_mark_offline) { + DEBUG(SSSDBG_TRACE_FUNC, + ("Failed to connect to server, but ignore mark offline " + "is enabled.\n")); + } else { + /* be is going offline as there is no more servers to try */ + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to connect, going offline (%d [%s])\n", + ret, strerror(ret))); + be_mark_offline(conn_cache->id_conn->id_ctx->be); + } is_offline = true; } -- cgit