andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame 0303-Ticket-47963-memberof-skip-nested-groups-breaks-the-.patch

dc8c34
From 6347e38d95c3f28c27323acb585d99909a2b98d9 Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Tue, 3 Feb 2015 19:43:46 -0500
dc8c34
Subject: [PATCH 303/305] Ticket 47963 - memberof skip nested groups breaks the
dc8c34
 plugin
dc8c34
dc8c34
Bug Description:  The previous patch broke the memberOf plugin - it
dc8c34
                  basically wouldn't do anything.  The skip was being
dc8c34
                  done too early.
dc8c34
dc8c34
Fix Description:  Move the "recursion skip" to the appropriate location.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47963
dc8c34
dc8c34
Reviewed by: nhosoi(Thanks!)
dc8c34
dc8c34
(cherry picked from commit 70d5fe69846482bb82723e300389469924c2cd85)
dc8c34
(cherry picked from commit ffc784c20554edcfa496472a3b438e31d20d6a4a)
dc8c34
---
dc8c34
 ldap/servers/plugins/memberof/memberof.c | 16 ++++++++--------
dc8c34
 1 file changed, 8 insertions(+), 8 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/plugins/memberof/memberof.c b/ldap/servers/plugins/memberof/memberof.c
dc8c34
index 0098829..7cb0e27 100644
dc8c34
--- a/ldap/servers/plugins/memberof/memberof.c
dc8c34
+++ b/ldap/servers/plugins/memberof/memberof.c
dc8c34
@@ -1721,6 +1721,7 @@ int memberof_get_groups_callback(Slapi_Entry *e, void *callback_data)
dc8c34
 	char *group_dn = slapi_entry_get_ndn(e);
dc8c34
 	Slapi_Value *group_dn_val = 0;
dc8c34
 	Slapi_ValueSet *groupvals = *((memberof_get_groups_data*)callback_data)->groupvals;
dc8c34
+	MemberOfConfig *config = ((memberof_get_groups_data*)callback_data)->config;
dc8c34
 	int rc = 0;
dc8c34
 
dc8c34
 	if(slapi_is_shutting_down()){
dc8c34
@@ -1778,10 +1779,11 @@ int memberof_get_groups_callback(Slapi_Entry *e, void *callback_data)
dc8c34
 	 * by the valueset. */ 
dc8c34
 	slapi_valueset_add_value_ext(groupvals, group_dn_val, SLAPI_VALUE_FLAG_PASSIN);
dc8c34
 
dc8c34
-	/* now recurse to find parent groups of e */
dc8c34
-	memberof_get_groups_r(((memberof_get_groups_data*)callback_data)->config,
dc8c34
-		group_sdn, callback_data);
dc8c34
-
dc8c34
+	if(!config->skip_nested || config->fixup_task){
dc8c34
+		/* now recurse to find parent groups of e */
dc8c34
+		memberof_get_groups_r(((memberof_get_groups_data*)callback_data)->config,
dc8c34
+		    group_sdn, callback_data);
dc8c34
+	}
dc8c34
 bail:
dc8c34
 	return rc;
dc8c34
 }
dc8c34
@@ -2468,10 +2470,8 @@ int memberof_fix_memberof_callback(Slapi_Entry *e, void *callback_data)
dc8c34
 	memberof_del_dn_data del_data = {0, config->memberof_attr};
dc8c34
 	Slapi_ValueSet *groups = 0;
dc8c34
 
dc8c34
-	if(!config->skip_nested || config->fixup_task){
dc8c34
-		/* get a list of all of the groups this user belongs to */
dc8c34
-		groups = memberof_get_groups(config, sdn);
dc8c34
-	}
dc8c34
+	/* get a list of all of the groups this user belongs to */
dc8c34
+	groups = memberof_get_groups(config, sdn);
dc8c34
 
dc8c34
 	/* If we found some groups, replace the existing memberOf attribute
dc8c34
 	 * with the found values.  */
dc8c34
-- 
dc8c34
1.9.3
dc8c34