dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 97616c8e1ab41c72c509a31626fafcfb07241a46 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Tue, 11 Feb 2014 12:23:51 +0100
Subject: [PATCH 84/84] LDAP: Handle errors from sdap_id_op properly in enum
 code
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Pavel Březina <pbrezina@redhat.com>
(cherry picked from commit 93dabb2fe0a798f22bb802b9c6521ab9e6a4ac36)
---
 src/providers/ldap/sdap_async_enum.c | 42 +++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/src/providers/ldap/sdap_async_enum.c b/src/providers/ldap/sdap_async_enum.c
index 0c20afa9d7a1b0198bb71cffdafcb14763c1dafb..0431d03c38098080847035d522ab5f1f494b8bfe 100644
--- a/src/providers/ldap/sdap_async_enum.c
+++ b/src/providers/ldap/sdap_async_enum.c
@@ -235,7 +235,7 @@ static void sdap_dom_enum_ex_posix_check_done(struct tevent_req *subreq)
 
     ret = sdap_posix_check_recv(subreq, &has_posix);
     talloc_zfree(subreq);
-    if (ret != EOK) {
+    if (ret != EOK && ret != ERR_NO_POSIX) {
         /* We can only finish the id_op on error as the connection
          * is re-used by the user search
          */
@@ -248,6 +248,16 @@ static void sdap_dom_enum_ex_posix_check_done(struct tevent_req *subreq)
                 tevent_req_error(req, ret);
             }
             return;
+        } else if (dp_error == DP_ERR_OFFLINE) {
+            DEBUG(SSSDBG_TRACE_FUNC, ("Backend is offline, retrying later\n"));
+            tevent_req_done(req);
+            return;
+        } else {
+            /* Non-recoverable error */
+            DEBUG(SSSDBG_OP_FAILURE,
+                ("POSIX check failed: %d: %s\n", ret, sss_strerror(ret)));
+            tevent_req_error(req, ret);
+            return;
         }
     }
 
@@ -306,6 +316,16 @@ static void sdap_dom_enum_ex_users_done(struct tevent_req *subreq)
             return;
         }
         return;
+    } else if (dp_error == DP_ERR_OFFLINE) {
+        DEBUG(SSSDBG_TRACE_FUNC, ("Backend is offline, retrying later\n"));
+        tevent_req_done(req);
+        return;
+    } else if (ret != EOK && ret != ENOENT) {
+        /* Non-recoverable error */
+        DEBUG(SSSDBG_OP_FAILURE,
+              ("User enumeration failed: %d: %s\n", ret, sss_strerror(ret)));
+        tevent_req_error(req, ret);
+        return;
     }
 
     state->group_op = sdap_id_op_create(state, state->group_conn->conn_cache);
@@ -367,6 +387,16 @@ static void sdap_dom_enum_ex_groups_done(struct tevent_req *subreq)
             return;
         }
         return;
+    } else if (dp_error == DP_ERR_OFFLINE) {
+        DEBUG(SSSDBG_TRACE_FUNC, ("Backend is offline, retrying later\n"));
+        tevent_req_done(req);
+        return;
+    } else if (ret != EOK && ret != ENOENT) {
+        /* Non-recoverable error */
+        DEBUG(SSSDBG_OP_FAILURE,
+              ("Group enumeration failed: %d: %s\n", ret, sss_strerror(ret)));
+        tevent_req_error(req, ret);
+        return;
     }
 
 
@@ -426,6 +456,16 @@ static void sdap_dom_enum_ex_svcs_done(struct tevent_req *subreq)
             return;
         }
         return;
+    } else if (dp_error == DP_ERR_OFFLINE) {
+        DEBUG(SSSDBG_TRACE_FUNC, ("Backend is offline, retrying later\n"));
+        tevent_req_done(req);
+        return;
+    } else if (ret != EOK && ret != ENOENT) {
+        /* Non-recoverable error */
+        DEBUG(SSSDBG_OP_FAILURE,
+              ("Service enumeration failed: %d: %s\n", ret, sss_strerror(ret)));
+        tevent_req_error(req, ret);
+        return;
     }
 
     /* Ok, we've completed an enumeration. Save this to the
-- 
1.8.5.3