Blame SOURCES/0166-LDAP-AD-Do-not-fail-in-case-rfc2307bis_nested_groups.patch

956cae
From b9460652c3ab86b1b0cfe1e8ea868e6e0bb492ad Mon Sep 17 00:00:00 2001
956cae
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
956cae
Date: Mon, 1 May 2017 14:49:50 +0200
956cae
Subject: [PATCH 166/166] LDAP/AD: Do not fail in case
956cae
 rfc2307bis_nested_groups_recv() returns ENOENT
956cae
MIME-Version: 1.0
956cae
Content-Type: text/plain; charset=UTF-8
956cae
Content-Transfer-Encoding: 8bit
956cae
956cae
Commit 25699846 introduced a regression seen when an initgroup lookup is
956cae
done and there's no nested groups involved.
956cae
956cae
In this scenario the whole lookup fails due to an ENOENT returned by
956cae
rfc2307bis_nested_groups_recv(), which leads to the user removal from
956cae
sysdb causing some authentication issues.
956cae
956cae
Resolves:
956cae
https://pagure.io/SSSD/sssd/issue/3331
956cae
956cae
Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
956cae
Reviewed-by: Sumit Bose <sbose@redhat.com>
956cae
(cherry picked from commit df4b24bed15f45bf286fb0102fd397218fdd4186)
956cae
(cherry picked from commit 4540d9f6817c78eef7b6e2d79245434811b59ad9)
956cae
---
956cae
 src/providers/ldap/sdap_async_initgroups_ad.c | 8 +++++++-
956cae
 1 file changed, 7 insertions(+), 1 deletion(-)
956cae
956cae
diff --git a/src/providers/ldap/sdap_async_initgroups_ad.c b/src/providers/ldap/sdap_async_initgroups_ad.c
956cae
index 1fee4ab43a6c13803a088ffa4695dde7f39b3d2b..904cffd820fa1f0aeb86929b41b0d7523f36d315 100644
956cae
--- a/src/providers/ldap/sdap_async_initgroups_ad.c
956cae
+++ b/src/providers/ldap/sdap_async_initgroups_ad.c
956cae
@@ -1746,7 +1746,13 @@ static void sdap_ad_get_domain_local_groups_done(struct tevent_req *subreq)
956cae
 
956cae
     ret = rfc2307bis_nested_groups_recv(subreq);
956cae
     talloc_zfree(subreq);
956cae
-    if (ret != EOK) {
956cae
+    if (ret == ENOENT) {
956cae
+        /* In case of ENOENT we can just proceed without making
956cae
+         * sdap_get_initgr_user() fail because there's no nested
956cae
+         * groups for this user/group. */
956cae
+        ret = EOK;
956cae
+        goto done;
956cae
+    } else if (ret != EOK) {
956cae
         tevent_req_error(req, ret);
956cae
         return;
956cae
     }
956cae
-- 
956cae
2.9.3
956cae