summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-05-22 15:19:31 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-06-19 14:09:45 +0200
commit0a7aebf3d35a2ebed743d92f14f0b098a3220f82 (patch)
treee865a686d08aa077e1b265fcefac017a8c2b3e96
parente0839fb91624a58f01fd6c9b454a18327d8707bd (diff)
downloadsssd-0a7aebf3d35a2ebed743d92f14f0b098a3220f82.tar.gz
sssd-0a7aebf3d35a2ebed743d92f14f0b098a3220f82.tar.xz
sssd-0a7aebf3d35a2ebed743d92f14f0b098a3220f82.zip
Download complete groups if ignore_group_members is set with tokengroups
Resolves: https://fedorahosted.org/sssd/ticket/2644 When tokenGroups are enabled, we save groups using their SID as the RDN attribute during initgroups() and later, if the groups is requested and saved again with the full name, remove the original and save the new group entry. Saving the new group entry would break if ignore_group_members is also set, because the new group entry would lack the "member" attribute, so the member/memberof links between the new group and the user entry wouldn't be established again. This patch changes the initgroups processing so that the full group object is fetched when initgroups is enabled but together with ignore_group_members. This solution imposes some performance impact, because instead of one search for tokenGroups we also need to resolve the groups. The more systematic solution would be to get rid of removing the group entry as described in https://fedorahosted.org/sssd/ticket/2656 To reproduce the bug, set: ignore_group_members = True with a backend that uses: id_provider = ad Then run: $ id aduser@ad_domain.com $ id aduser@ad_domain.com Reviewed-by: Sumit Bose <sbose@redhat.com> (cherry picked from commit ee44aac95e42c3cb634876286a2aa4960ac69a2b) (cherry picked from commit 44f35a0f32785bf460b5d05424f5e9a15f4f4028)
-rw-r--r--src/providers/ldap/sdap_async_initgroups_ad.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/providers/ldap/sdap_async_initgroups_ad.c b/src/providers/ldap/sdap_async_initgroups_ad.c
index 15855b4e3..1de851807 100644
--- a/src/providers/ldap/sdap_async_initgroups_ad.c
+++ b/src/providers/ldap/sdap_async_initgroups_ad.c
@@ -1451,7 +1451,18 @@ sdap_ad_tokengroups_initgroups_send(TALLOC_CTX *mem_ctx,
state->use_id_mapping = use_id_mapping;
state->domain = domain;
- if (state->use_id_mapping && !IS_SUBDOMAIN(state->domain)) {
+ /* We can compute the the gidNumber attribute from SIDs obtained from
+ * the tokenGroups lookup in case ID mapping is used for a user from the
+ * parent domain. For trusted domains, we need to know the group type
+ * to be able to filter out domain-local groups. Additionally, as a
+ * temporary workaround until https://fedorahosted.org/sssd/ticket/2656
+ * is fixed, we also fetch the group object if group members are ignored
+ * to avoid having to transfer and retain members when the fake
+ * tokengroups object without name is replaced by the full group object
+ */
+ if (state->use_id_mapping
+ && !IS_SUBDOMAIN(state->domain)
+ && state->domain->ignore_group_members == false) {
subreq = sdap_ad_tokengroups_initgr_mapping_send(state, ev, opts,
sysdb, domain, sh,
name, orig_dn,
@@ -1491,7 +1502,9 @@ static void sdap_ad_tokengroups_initgroups_done(struct tevent_req *subreq)
req = tevent_req_callback_data(subreq, struct tevent_req);
state = tevent_req_data(req, struct sdap_ad_tokengroups_initgroups_state);
- if (state->use_id_mapping && !IS_SUBDOMAIN(state->domain)) {
+ if (state->use_id_mapping
+ && !IS_SUBDOMAIN(state->domain)
+ && state->domain->ignore_group_members == false) {
ret = sdap_ad_tokengroups_initgr_mapping_recv(subreq);
} else {
ret = sdap_ad_tokengroups_initgr_posix_recv(subreq);