[Fedora-directory-commits] ldapserver/ldap/servers/plugins/views views.c, 1.12, 1.13

Richard Allen Megginson rmeggins at fedoraproject.org
Thu Feb 5 15:19:03 UTC 2009


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/views
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv18122/ldapserver/ldap/servers/plugins/views

Modified Files:
	views.c 
Log Message:
Resolves: bug 483254
Bug Description: Modification of nsViewFilter of a virtual view OU crashes the server
Reviewed by: nhosoi, andrey.ivanov (Thanks!)
Fix Description: When we delete a node, not only do we need to have the parent node discover its new children, we need to have each child discover a new parent.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no



Index: views.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/views/views.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- views.c	15 Oct 2008 06:30:02 -0000	1.12
+++ views.c	5 Feb 2009 15:19:01 -0000	1.13
@@ -131,6 +131,7 @@
 static int views_cache_add_dn_views(char *dn, viewEntry **pViews);
 static void views_cache_add_ll_entry(void** attrval, void *theVal);
 static void views_cache_discover_parent(viewEntry *pView);
+static void views_cache_discover_parent_for_children(viewEntry *pView);
 static void views_cache_discover_children(viewEntry *pView);
 static void views_cache_discover_view_scope(viewEntry *pView);
 static void views_cache_create_applied_filter(viewEntry *pView);
@@ -658,6 +659,22 @@
 	}
 }
 
+/*
+	views_cache_discover_parent_for_children
+	------------------------------
+	The current node is being deleted - for each child, need
+	to find a new parent
+*/
+static void views_cache_discover_parent_for_children(viewEntry *pView)
+{
+	int ii = 0;
+	
+	for (ii = 0; pView->pChildren && (ii < pView->child_count); ++ii)
+	{
+		viewEntry *current = (viewEntry *)pView->pChildren[ii];
+		views_cache_discover_parent(current);
+	}
+}
 
 /*
 	views_cache_discover_children
@@ -1471,9 +1488,11 @@
 						theCache.pCacheViews = (viewEntry*)(theView->list.pNext);
 				}
 
-				/* update children */
+				/* the parent of this node needs to know about its children */
 				if(theView->pParent)
 					views_cache_discover_children((viewEntry*)theView->pParent);
+				/* each child of the deleted node will need to discover a new parent */
+				views_cache_discover_parent_for_children((viewEntry*)theView);
 
 				/* update filters */
 				for(current = theCache.pCacheViews; current != NULL; current = current->list.pNext)




More information about the Fedora-directory-commits mailing list