Blame SOURCES/0122-AD-LDAP-do-not-fall-back-to-mpg-user-lookup-on-GC-co.patch

96eb28
From 4dbfa49f50fd785f374209c2e59205e79533788e Mon Sep 17 00:00:00 2001
96eb28
From: Sumit Bose <sbose@redhat.com>
96eb28
Date: Tue, 29 May 2018 15:46:33 +0200
96eb28
Subject: [PATCH] AD/LDAP: do not fall back to mpg user lookup on GC connection
96eb28
96eb28
For MPG domains a group lookup might fall back to a user lookup to check
96eb28
if the request is for a user private group. Since we cannot be sure that
96eb28
all needed attributes for a user are replicated to the Global Catalog we
96eb28
do not want to lookup the user during the fall back from the Global
96eb28
Catalog.
96eb28
96eb28
Since we cannot skip Global Catalog lookups for groups completely due to
96eb28
membership to groups with universal scope this patch adds a flag to tell
96eb28
the lower level lookup calls to not fall back on connections to a Global
96eb28
Catalog.
96eb28
96eb28
Related to https://pagure.io/SSSD/sssd/issue/3748
96eb28
96eb28
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
96eb28
(cherry picked from commit ad6ab352879264fdade8861aff53aa035a2e2240)
96eb28
---
96eb28
 src/providers/ad/ad_common.c     | 1 +
96eb28
 src/providers/ldap/ldap_common.h | 2 ++
96eb28
 src/providers/ldap/ldap_id.c     | 3 ++-
96eb28
 3 files changed, 5 insertions(+), 1 deletion(-)
96eb28
96eb28
diff --git a/src/providers/ad/ad_common.c b/src/providers/ad/ad_common.c
96eb28
index 2a1647173b76b410371315eb364e9a3785714a93..1dca2fe279cb7d6d647aed42e3b3fabfb34b7dac 100644
96eb28
--- a/src/providers/ad/ad_common.c
96eb28
+++ b/src/providers/ad/ad_common.c
96eb28
@@ -1375,6 +1375,7 @@ ad_gc_conn_list(TALLOC_CTX *mem_ctx, struct ad_id_ctx *ad_ctx,
96eb28
     if (dp_opt_get_bool(ad_ctx->ad_options->basic, AD_ENABLE_GC)) {
96eb28
         clist[cindex] = ad_ctx->gc_ctx;
96eb28
         clist[cindex]->ignore_mark_offline = true;
96eb28
+        clist[cindex]->no_mpg_user_fallback = true;
96eb28
         cindex++;
96eb28
     }
96eb28
 
96eb28
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
96eb28
index 44dbc3fb0678412f46366321e0be836313380949..21cb57b0e7b265972db74ac78a3c1fb4ba2a9529 100644
96eb28
--- a/src/providers/ldap/ldap_common.h
96eb28
+++ b/src/providers/ldap/ldap_common.h
96eb28
@@ -57,6 +57,8 @@ struct sdap_id_conn_ctx {
96eb28
     struct sdap_id_conn_ctx *prev, *next;
96eb28
     /* do not go offline, try another connection */
96eb28
     bool ignore_mark_offline;
96eb28
+    /* do not fall back to user lookups for mpg domains on this connection */
96eb28
+    bool no_mpg_user_fallback;
96eb28
 };
96eb28
 
96eb28
 struct sdap_id_ctx {
96eb28
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
96eb28
index 3824f8f9aa8d2892664f1182376bedf6fb8627f6..365d90fd1cdfba86c719b3669d057444a7449d66 100644
96eb28
--- a/src/providers/ldap/ldap_id.c
96eb28
+++ b/src/providers/ldap/ldap_id.c
96eb28
@@ -1076,7 +1076,8 @@ static void groups_get_done(struct tevent_req *subreq)
96eb28
     }
96eb28
 
96eb28
     if (ret == ENOENT
96eb28
-            && state->domain->mpg == true) {
96eb28
+            && state->domain->mpg == true
96eb28
+            && !state->conn->no_mpg_user_fallback) {
96eb28
         /* The requested filter did not find a group. Before giving up, we must
96eb28
          * also check if the GID can be resolved through a primary group of a
96eb28
          * user
96eb28
-- 
96eb28
2.14.4
96eb28