Blame SOURCES/0022-AD-LDAP-Do-not-misuse-the-ignore_mark_offline-to-che.patch

cdf651
From 7b8ed13c2bac164fdc49227d1b51364bdf907a98 Mon Sep 17 00:00:00 2001
cdf651
From: Jakub Hrozek <jhrozek@redhat.com>
cdf651
Date: Tue, 19 Jun 2018 16:09:30 +0200
cdf651
Subject: [PATCH] AD/LDAP: Do not misuse the ignore_mark_offline to check if a
cdf651
 connection needs to be checked for POSIX attribute presence
cdf651
MIME-Version: 1.0
cdf651
Content-Type: text/plain; charset=UTF-8
cdf651
Content-Transfer-Encoding: 8bit
cdf651
cdf651
The logic behind deciding whether to check if a server contains any
cdf651
POSIX attributes used the ignore_mark_offline flag. This was OK for some
cdf651
time, because this flag was only set for to true for Global Catalog
cdf651
connections, which are those that we need to check.
cdf651
cdf651
However, in recent releases, the flag was also set for any connection
cdf651
towards a trusted domain. This had the unintended effect that any
cdf651
lookup, LDAP or GC against a trusted domain ran the wide POSIX presence
cdf651
check.
cdf651
cdf651
Resolves:
cdf651
https://pagure.io/SSSD/sssd/issue/3754
cdf651
cdf651
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
cdf651
(cherry picked from commit 5e1641b104f159f9fa47c3008d84119dfd5ab226)
cdf651
cdf651
DOWNSTREAM:
cdf651
Resolves: rhbz#1583725 - SSSD AD uses LDAP filter to detect POSIX attributes stored in AD GC also for regular AD DC queries
cdf651
---
cdf651
 src/providers/ad/ad_common.c     | 2 ++
cdf651
 src/providers/ldap/ldap_common.c | 2 +-
cdf651
 src/providers/ldap/ldap_common.h | 2 ++
cdf651
 3 files changed, 5 insertions(+), 1 deletion(-)
cdf651
cdf651
diff --git a/src/providers/ad/ad_common.c b/src/providers/ad/ad_common.c
cdf651
index 8caaba6c0d06cfe83d9741536192d662fc936273..feeb5d09643a02b99be1a387b41842a034a323b8 100644
cdf651
--- a/src/providers/ad/ad_common.c
cdf651
+++ b/src/providers/ad/ad_common.c
cdf651
@@ -1408,6 +1408,7 @@ ad_gc_conn_list(TALLOC_CTX *mem_ctx, struct ad_id_ctx *ad_ctx,
cdf651
         clist[cindex] = ad_ctx->gc_ctx;
cdf651
         clist[cindex]->ignore_mark_offline = true;
cdf651
         clist[cindex]->no_mpg_user_fallback = true;
cdf651
+        clist[cindex]->check_posix_attrs = true;
cdf651
         cindex++;
cdf651
     }
cdf651
 
cdf651
@@ -1454,6 +1455,7 @@ ad_user_conn_list(TALLOC_CTX *mem_ctx,
cdf651
             && IS_SUBDOMAIN(dom)) {
cdf651
         clist[cindex] = ad_ctx->gc_ctx;
cdf651
         clist[cindex]->ignore_mark_offline = true;
cdf651
+        clist[cindex]->check_posix_attrs = true;
cdf651
         cindex++;
cdf651
     }
cdf651
 
cdf651
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
cdf651
index 15377ee1f062c0167aabee30ef0757ebe7271682..a0a9b8523310b2551ee992f8d0c2e369dafaa56d 100644
cdf651
--- a/src/providers/ldap/ldap_common.c
cdf651
+++ b/src/providers/ldap/ldap_common.c
cdf651
@@ -893,7 +893,7 @@ bool should_run_posix_check(struct sdap_id_ctx *ctx,
cdf651
     if (use_id_mapping == false &&
cdf651
             posix_request == true &&
cdf651
             ctx->opts->schema_type == SDAP_SCHEMA_AD &&
cdf651
-            conn->ignore_mark_offline == true &&
cdf651
+            conn->check_posix_attrs == true &&
cdf651
             ctx->srv_opts &&
cdf651
             ctx->srv_opts->posix_checked == false) {
cdf651
         return true;
cdf651
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
cdf651
index 3cefdd0bfb0e96b5a7f904fe753dfc457b2a45c2..3de3568cb28c258c00f9b522c0b9120adca81d81 100644
cdf651
--- a/src/providers/ldap/ldap_common.h
cdf651
+++ b/src/providers/ldap/ldap_common.h
cdf651
@@ -59,6 +59,8 @@ struct sdap_id_conn_ctx {
cdf651
     bool ignore_mark_offline;
cdf651
     /* do not fall back to user lookups for mpg domains on this connection */
cdf651
     bool no_mpg_user_fallback;
cdf651
+    /* check if this connection contains POSIX attributes */
cdf651
+    bool check_posix_attrs;
cdf651
 };
cdf651
 
cdf651
 struct sdap_id_ctx {
cdf651
-- 
cdf651
2.17.1
cdf651