Blame SOURCES/0121-ipa-allow-mpg-group-objects-in-apply_subdomain_homed.patch

75e304
From 8bbee851484f7fa51af542ed2757e2eea36bf535 Mon Sep 17 00:00:00 2001
75e304
From: Sumit Bose <sbose@redhat.com>
75e304
Date: Tue, 29 May 2018 15:44:28 +0200
75e304
Subject: [PATCH] ipa: allow mpg group objects in apply_subdomain_homedir()
75e304
75e304
Since with algorithmic id-mapping SSSD automatically creates user
75e304
private groups for AD user with the help of magic private groups (mpg)
75e304
apply_subdomain_homedir() should be aware the in mpg domains a group
75e304
lookup might actually return a user object. Since the related sysdb
75e304
calls are clever and replace the objectcategory so that it matches the
75e304
original request type we have to check for the group category in the mpg
75e304
case as well. apply_subdomain_homedir() checks the uidNumber later as
75e304
well to make sure the object has the needed attributes for a user.
75e304
75e304
Related to https://pagure.io/SSSD/sssd/issue/3748
75e304
75e304
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
75e304
(cherry picked from commit e66517dcf63f1d4aaf866c22371dac7740ce0a48)
75e304
---
75e304
 src/providers/ipa/ipa_subdomains_id.c | 9 ++++++++-
75e304
 1 file changed, 8 insertions(+), 1 deletion(-)
75e304
75e304
diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
75e304
index 3943579b07c7b2d32dde192b97b86eb036b91885..c2064d33029a27a2c5d4b5344034ce90f8e746b8 100644
75e304
--- a/src/providers/ipa/ipa_subdomains_id.c
75e304
+++ b/src/providers/ipa/ipa_subdomains_id.c
75e304
@@ -895,9 +895,16 @@ apply_subdomain_homedir(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom,
75e304
         goto done;
75e304
     }
75e304
 
75e304
+    /* The object is a user if SYSDB_OBJECTCATEGORY is SYSDB_USER_CLASS or in
75e304
+     * case of a MPG group lookup if SYSDB_OBJECTCATEGORY is SYSDB_GROUP_CLASS.
75e304
+     */
75e304
     for (c = 0; c < msg_el->num_values; c++) {
75e304
         if (strncmp(SYSDB_USER_CLASS, (const char *)msg_el->values[c].data,
75e304
-                    msg_el->values[c].length) == 0) {
75e304
+                    msg_el->values[c].length) == 0
75e304
+                || (dom->mpg
75e304
+                    && strncmp(SYSDB_GROUP_CLASS,
75e304
+                               (const char *)msg_el->values[c].data,
75e304
+                               msg_el->values[c].length) == 0)) {
75e304
             break;
75e304
         }
75e304
     }
75e304
-- 
75e304
2.14.4
75e304