Please, see the attached patch.

It passed CI: http://sssd-ci.duckdns.org/logs/job/50/66/summary.html

Best Regards,
-- 
Fabiano Fidêncio
From 81a0fa7459e8f63d655bed66e4f810439283a55c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <[email protected]>
Date: Tue, 2 Aug 2016 09:08:18 +0200
Subject: [PATCH] SDAP: Don't log an op failure when no users are found
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When no users are found during the search users process, just log (at
TRACEL_ALL level) that zero users were retrieve and avoid logging (at
OP_FAILURE level) that a failure has occurred, which may end up
misleading admins, giving them the impression that something wrong has
happened.

Signed-off-by: Fabiano Fidêncio <[email protected]>

Resolves: https://fedorahosted.org/sssd/ticket/3089
---
 src/providers/ldap/sdap_async_users.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c
index cccd250..76844ae 100644
--- a/src/providers/ldap/sdap_async_users.c
+++ b/src/providers/ldap/sdap_async_users.c
@@ -802,6 +802,8 @@ static void sdap_search_user_process(struct tevent_req *subreq)
         }
     }
 
+    DEBUG(SSSDBG_TRACE_ALL, "Retrieved total %zu users\n", state->count);
+
     /* No more search bases
      * Return ENOENT if no users were found
      */
@@ -810,7 +812,6 @@ static void sdap_search_user_process(struct tevent_req *subreq)
         return;
     }
 
-    DEBUG(SSSDBG_TRACE_ALL, "Retrieved total %zu users\n", state->count);
     tevent_req_done(req);
 }
 
@@ -928,8 +929,10 @@ static void sdap_get_users_done(struct tevent_req *subreq)
     ret = sdap_search_user_recv(state, subreq, &state->higher_usn,
                                 &state->users, &state->count);
     if (ret) {
-        DEBUG(SSSDBG_OP_FAILURE, "Failed to retrieve users [%d][%s].\n",
-              ret, sss_strerror(ret));
+        if (ret != ENOENT) {
+            DEBUG(SSSDBG_OP_FAILURE, "Failed to retrieve users [%d][%s].\n",
+                  ret, sss_strerror(ret));
+        }
         tevent_req_error(req, ret);
         return;
     }
-- 
2.7.4

_______________________________________________
sssd-devel mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to