There can be an unlikely scenario when the first part of
sdap_id_op_connect_done works fine and there is no need to mark backend
offline. But right after the check, the memory allocation can fail in
which case the backend needs to be marked offline along with disabled 
reconnecting.

-- 
Thank you
Jan Zeleny

Red Hat Software Engineer
Brno, Czech Republic
From 80f95a44abbd1aba7f8ec23580bc037238f16656 Mon Sep 17 00:00:00 2001
From: Jan Zeleny <jzel...@redhat.com>
Date: Fri, 11 Mar 2011 11:51:34 -0500
Subject: [PATCH] Fix one unlikely case of failure in sdap_id_op module

There can be an unlikely scenario when the first part of
sdap_id_op_connect_done works fine and there is no need to mark backend
offline. But right after the check, the memory allocation can fail in
which case the backend needs to be marked offline along with disabled
reconnecting.
---
 src/providers/ldap/sdap_id_op.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/providers/ldap/sdap_id_op.c b/src/providers/ldap/sdap_id_op.c
index 29cd8357d1c63fdf06756b88ff7cd789bb1387cd..c2431010467c2f92b6a4b6137c19c681c5dd72ec 100644
--- a/src/providers/ldap/sdap_id_op.c
+++ b/src/providers/ldap/sdap_id_op.c
@@ -523,7 +523,7 @@ static void sdap_id_op_connect_done(struct tevent_req *subreq)
         /* 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_data->conn_cache->id_ctx->be);
+        be_mark_offline(conn_cache->id_ctx->be);
         is_offline = true;
     }
 
@@ -560,6 +560,8 @@ static void sdap_id_op_connect_done(struct tevent_req *subreq)
             default:
                 /* do not attempt to retry on errors like ENOMEM */
                 can_retry = false;
+                is_offline = true;
+                be_mark_offline(conn_cache->id_ctx->be);
                 break;
         }
     }
-- 
1.7.4.1

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to