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

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