>From a5b0e35de6a9cb6e9e1881deaae9fa55701aa33a Mon Sep 17 00:00:00 2001
From: Petr Cech <pcech@redhat.com>
Date: Fri, 4 Sep 2015 09:09:25 -0400
Subject: [PATCH] IPA PROVIDER: Resolve nested netgroup membership

Informations about posix/user group membership are stored in memberOf
attribute. And informations about hostgroup membership are stored
in originalMemberOf.
Netgroup membership process looks only into originalMemberOf.
This patch adds saving of posix/user group memberOf attribute to
originalMemberOf storage.

Resolves:
https://fedorahosted.org/sssd/ticket/XXXX
---
 src/providers/ad/ad_opts.h     | 1 +
 src/providers/ipa/ipa_opts.h   | 1 +
 src/providers/ldap/ldap_opts.h | 3 +++
 src/providers/ldap/sdap.h      | 1 +
 4 files changed, 6 insertions(+)

diff --git a/src/providers/ad/ad_opts.h b/src/providers/ad/ad_opts.h
index 00586a7ada63ad4c89630e9589d3ff75d1726703..7917e8fc5e60ed27e7ed1248550d1e65d2d159d2 100644
--- a/src/providers/ad/ad_opts.h
+++ b/src/providers/ad/ad_opts.h
@@ -192,6 +192,7 @@ struct sdap_attr_map ad_2008r2_user_map[] = {
     { "ldap_user_principal", "userPrincipalName", SYSDB_UPN, NULL },
     { "ldap_user_fullname", "name", SYSDB_FULLNAME, NULL },
     { "ldap_user_member_of", "memberOf", SYSDB_MEMBEROF, NULL },
+    { "ldap_user_member_of", "memberOf", SYSDB_ORIG_MEMBEROF, NULL },
     { "ldap_user_uuid", "objectGUID", SYSDB_UUID, NULL },
     { "ldap_user_objectsid", "objectSID", SYSDB_SID, NULL },
     { "ldap_user_primary_group", "primaryGroupID", SYSDB_PRIMARY_GROUP, NULL },
diff --git a/src/providers/ipa/ipa_opts.h b/src/providers/ipa/ipa_opts.h
index 78949e3ddec95f7f4303eab905bbbf6ec14ed6ae..9b5fdd138fbdf09f3d3662c011ea792f6272b7a6 100644
--- a/src/providers/ipa/ipa_opts.h
+++ b/src/providers/ipa/ipa_opts.h
@@ -180,6 +180,7 @@ struct sdap_attr_map ipa_user_map[] = {
     { "ldap_user_principal", "krbPrincipalName", SYSDB_UPN, NULL },
     { "ldap_user_fullname", "cn", SYSDB_FULLNAME, NULL },
     { "ldap_user_member_of", "memberOf", SYSDB_MEMBEROF, NULL },
+    { "ldap_user_member_of", "memberOf", SYSDB_ORIG_MEMBEROF, NULL },
     { "ldap_user_uuid", "ipaUniqueID", SYSDB_UUID, NULL },
     { "ldap_user_objectsid", "ipaNTSecurityIdentifier", SYSDB_SID_STR, NULL },
     { "ldap_user_primary_group", NULL, SYSDB_PRIMARY_GROUP, NULL },
diff --git a/src/providers/ldap/ldap_opts.h b/src/providers/ldap/ldap_opts.h
index 9f58db5bd9eef1391e97c1890cbff94c2a5406d6..db7bc560f430331462470b2825f6319dbaaf9141 100644
--- a/src/providers/ldap/ldap_opts.h
+++ b/src/providers/ldap/ldap_opts.h
@@ -156,6 +156,7 @@ struct sdap_attr_map rfc2307_user_map[] = {
     { "ldap_user_principal", "krbPrincipalName", SYSDB_UPN, NULL },
     { "ldap_user_fullname", "cn", SYSDB_FULLNAME, NULL },
     { "ldap_user_member_of", NULL, SYSDB_MEMBEROF, NULL },
+    { "ldap_user_member_of", NULL, SYSDB_ORIG_MEMBEROF, NULL },
     { "ldap_user_uuid", NULL, SYSDB_UUID, NULL },
     { "ldap_user_objectsid", NULL, SYSDB_SID, NULL },
     { "ldap_user_primary_group", NULL, SYSDB_PRIMARY_GROUP, NULL },
@@ -212,6 +213,7 @@ struct sdap_attr_map rfc2307bis_user_map[] = {
     { "ldap_user_principal", "krbPrincipalName", SYSDB_UPN, NULL },
     { "ldap_user_fullname", "cn", SYSDB_FULLNAME, NULL },
     { "ldap_user_member_of", "memberOf", SYSDB_MEMBEROF, NULL },
+    { "ldap_user_member_of", "memberOf", SYSDB_ORIG_MEMBEROF, NULL },
     { "ldap_user_uuid", NULL, SYSDB_UUID, NULL },
     { "ldap_user_objectsid", NULL, SYSDB_SID, NULL },
     { "ldap_user_primary_group", NULL, SYSDB_PRIMARY_GROUP, NULL },
@@ -268,6 +270,7 @@ struct sdap_attr_map gen_ad2008r2_user_map[] = {
     { "ldap_user_principal", "userPrincipalName", SYSDB_UPN, NULL },
     { "ldap_user_fullname", "name", SYSDB_FULLNAME, NULL },
     { "ldap_user_member_of", "memberOf", SYSDB_MEMBEROF, NULL },
+    { "ldap_user_member_of", "memberOf", SYSDB_ORIG_MEMBEROF, NULL },
     { "ldap_user_uuid", "objectGUID", SYSDB_UUID, NULL },
     { "ldap_user_objectsid", "objectSID", SYSDB_SID, NULL },
     { "ldap_user_primary_group", "primaryGroupID", SYSDB_PRIMARY_GROUP, NULL },
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
index b3321be48e1b24124d59fbfe88096a2109c920a6..7c54405dcf795e4f22ba559757619042620691f3 100644
--- a/src/providers/ldap/sdap.h
+++ b/src/providers/ldap/sdap.h
@@ -257,6 +257,7 @@ enum sdap_user_attrs {
     SDAP_AT_USER_PRINC,
     SDAP_AT_USER_FULLNAME,
     SDAP_AT_USER_MEMBEROF,
+    SDAP_AT_USER_ORIG_MEMBEROF,
     SDAP_AT_USER_UUID,
     SDAP_AT_USER_OBJECTSID,
     SDAP_AT_USER_PRIMARY_GROUP,
-- 
2.4.3

