summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2009-02-05 15:19:01 +0000
committerRich Megginson <rmeggins@redhat.com>2009-02-05 15:19:01 +0000
commit897b284c3095bb4e95cb239af4b2cb23de0ebbf9 (patch)
tree3c2041bd5e28df5b886643bfdf69d5a89aad02b7
parent0fb5cccfabffd94b3ebec2a0c24423741c0733e1 (diff)
downloadds-897b284c3095bb4e95cb239af4b2cb23de0ebbf9.tar.gz
ds-897b284c3095bb4e95cb239af4b2cb23de0ebbf9.tar.xz
ds-897b284c3095bb4e95cb239af4b2cb23de0ebbf9.zip
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
-rw-r--r--ldap/servers/plugins/views/views.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/ldap/servers/plugins/views/views.c b/ldap/servers/plugins/views/views.c
index 1d1f2e82..cc310077 100644
--- a/ldap/servers/plugins/views/views.c
+++ b/ldap/servers/plugins/views/views.c
@@ -131,6 +131,7 @@ static int views_dn_views_cb (Slapi_Entry* e, void *callback_data);
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 @@ static void views_cache_discover_parent(viewEntry *pView)
}
}
+/*
+ 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 @@ static void views_update_views_cache( Slapi_Entry *e, char *dn, int modtype, Sla
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)