Blob Blame History Raw
From e67f94d854ef125626294771473a1204726eeba4 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Mon, 15 Jan 2018 22:11:24 +0100
Subject: [PATCH 93/96] AD: Inherit the MPG setting from the main domain
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If the auto_private_groups option was set in the domain section for
direct integration, it only had an effect on the joined domain, not any
of the subdomains, so requesting a user from the child domain would look
like this:
    $ id childuser@child.win.trust.test
    uid=30000(childuser@child.win.trust.test) gid=40000(usergroup@child.win.trust.test) groups=40000(usergroup@child.win.trust.test)
The expected result, visible after this patch is:
    $ id childuser@child.win.trust.test
    uid=30000(childuser@child.win.trust.test) gid=30000(childuser@child.win.trust.test) groups=30000(childuser@child.win.trust.test),40000(usergroup@child.win.trust.test)

Resolves:
https://pagure.io/SSSD/sssd/issue/3613

Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
(cherry picked from commit 29ebf45f96b13590ae76a19c7c16c53f172e4ae4)
---
 src/providers/ad/ad_subdomains.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
index 3fb9b950f171d85817cce35ac92ad7c4974ccb68..1b9483a5dce937d6acdd813486a1e8c18210d35f 100644
--- a/src/providers/ad/ad_subdomains.c
+++ b/src/providers/ad/ad_subdomains.c
@@ -391,6 +391,13 @@ ad_subdom_store(struct sdap_idmap_ctx *idmap_ctx,
     }
 
     mpg = sdap_idmap_domain_has_algorithmic_mapping(idmap_ctx, name, sid_str);
+    if (mpg == false) {
+        /* Domains that use the POSIX attributes set by the admin must
+         * inherit the MPG setting from the parent domain so that the
+         * auto_private_groups options works for trusted domains as well
+         */
+        mpg = domain->mpg;
+    }
 
     ret = sysdb_subdomain_store(domain->sysdb, name, realm, flat, sid_str,
                                 mpg, enumerate, domain->forest, 0, NULL);
-- 
2.14.3