[SSSD] [PATCH] IPA: Don't fail the request when BE doesn't find the object

Jakub Hrozek jhrozek at redhat.com
Wed Oct 29 20:26:29 UTC 2014


Hi,

see the attached patch. To reproduce, just run 'getent group
nosuchgroup at ad.trusted.domain' and make sure that with the patch
applied, groups_get_done() or users_get_done() also run and attempt to
delete the nonexistant user or group.

Additionally, there is a variable called user_dom in the codepath which
handles both users and group. Shall I rename it to obj_dom or similar?
-------------- next part --------------
>From abc14678606bfe15fe8c1a4d06aa0c0dc09ee437 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 29 Oct 2014 20:30:20 +0100
Subject: [PATCH] IPA: Don't fail the request when BE doesn't find the object

The IPA subdomain code treated ENOENT as a fatal error, which resulted
in a loud error message and the whole request being aborted. This patch
ignores ENOENT.
---
 src/providers/ipa/ipa_subdomains_id.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
index b67006ce6e0b4bf9c794016c1dfc923ac6da3624..0a1c4c17eed37b2eb12a8c758e49fc17c3b642b5 100644
--- a/src/providers/ipa/ipa_subdomains_id.c
+++ b/src/providers/ipa/ipa_subdomains_id.c
@@ -942,7 +942,7 @@ static errno_t get_object_from_cache(TALLOC_CTX *mem_ctx,
         goto done;
     }
 
-    if (ret != EOK) {
+    if (ret != EOK && ret != ENOENT) {
         DEBUG(SSSDBG_OP_FAILURE,
               "Failed to make request to our cache: [%d]: [%s]\n",
                ret, sss_strerror(ret));
@@ -951,8 +951,6 @@ static errno_t get_object_from_cache(TALLOC_CTX *mem_ctx,
 
     *_msg = msg;
 
-    ret = EOK;
-
 done:
     return ret;
 }
@@ -978,7 +976,11 @@ ipa_get_ad_acct_ad_part_done(struct tevent_req *subreq)
 
     ret = get_object_from_cache(state, state->user_dom, state->ar,
                                 &state->obj_msg);
-    if (ret != EOK) {
+    if (ret == ENOENT) {
+        DEBUG(SSSDBG_MINOR_FAILURE, "Object not found, ending request\n");
+        tevent_req_done(req);
+        return;
+    } else if (ret != EOK) {
         DEBUG(SSSDBG_OP_FAILURE, "get_object_from_cache failed.\n");
         goto fail;
     }
-- 
1.9.3



More information about the sssd-devel mailing list