Blame SOURCES/0050-IPA-Don-t-fail-the-request-when-BE-doesn-t-find-the-.patch

905b4d
From 07ca52cf9c0727c42880ed03b4ffb3e6c5f7b97d Mon Sep 17 00:00:00 2001
905b4d
From: Jakub Hrozek <jhrozek@redhat.com>
905b4d
Date: Wed, 29 Oct 2014 20:30:20 +0100
905b4d
Subject: [PATCH 50/64] IPA: Don't fail the request when BE doesn't find the
905b4d
 object
905b4d
905b4d
The IPA subdomain code treated ENOENT as a fatal error, which resulted
905b4d
in a loud error message and the whole request being aborted. This patch
905b4d
ignores ENOENT.
905b4d
905b4d
Reviewed-by: Pavel Reichl <preichl@redhat.com>
905b4d
---
905b4d
 src/providers/ipa/ipa_subdomains_id.c | 10 ++++++----
905b4d
 1 file changed, 6 insertions(+), 4 deletions(-)
905b4d
905b4d
diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
905b4d
index b67006ce6e0b4bf9c794016c1dfc923ac6da3624..0a1c4c17eed37b2eb12a8c758e49fc17c3b642b5 100644
905b4d
--- a/src/providers/ipa/ipa_subdomains_id.c
905b4d
+++ b/src/providers/ipa/ipa_subdomains_id.c
905b4d
@@ -942,7 +942,7 @@ static errno_t get_object_from_cache(TALLOC_CTX *mem_ctx,
905b4d
         goto done;
905b4d
     }
905b4d
 
905b4d
-    if (ret != EOK) {
905b4d
+    if (ret != EOK && ret != ENOENT) {
905b4d
         DEBUG(SSSDBG_OP_FAILURE,
905b4d
               "Failed to make request to our cache: [%d]: [%s]\n",
905b4d
                ret, sss_strerror(ret));
905b4d
@@ -951,8 +951,6 @@ static errno_t get_object_from_cache(TALLOC_CTX *mem_ctx,
905b4d
 
905b4d
     *_msg = msg;
905b4d
 
905b4d
-    ret = EOK;
905b4d
-
905b4d
 done:
905b4d
     return ret;
905b4d
 }
905b4d
@@ -978,7 +976,11 @@ ipa_get_ad_acct_ad_part_done(struct tevent_req *subreq)
905b4d
 
905b4d
     ret = get_object_from_cache(state, state->user_dom, state->ar,
905b4d
                                 &state->obj_msg);
905b4d
-    if (ret != EOK) {
905b4d
+    if (ret == ENOENT) {
905b4d
+        DEBUG(SSSDBG_MINOR_FAILURE, "Object not found, ending request\n");
905b4d
+        tevent_req_done(req);
905b4d
+        return;
905b4d
+    } else if (ret != EOK) {
905b4d
         DEBUG(SSSDBG_OP_FAILURE, "get_object_from_cache failed.\n");
905b4d
         goto fail;
905b4d
     }
905b4d
-- 
905b4d
1.9.3
905b4d