ldap/servers/slapd/entrywsi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 9258b1836d7f5a5c22cab2d961044400a9d8857b
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Fri Dec 6 09:29:38 2013 +0100
Ticket 47612 - ns-slapd eats all the memory
Bug Description: slpad process quickly grows and runs out of memory
The reason is that an entry is copied and one of teh attributes
has a next reference to itself, so that it will try to copy it
infinitely.
The state is an effect of moving an attribute to the deleted
attributes if the present valueset is empty, but in urp this
is also called for deleted attributes and so ti will be added
again.
Fix Description: check if attribute is present before moving to deleted
https://fedorahosted.org/389/ticket/47612
Reviewed by: ?
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index a725ddb..f4f6481 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -785,7 +785,7 @@ entry_delete_present_values_wsi_multi_valued(Slapi_Entry *e, const
char *type, s
{
int retVal= LDAP_SUCCESS;
Slapi_Attr *a= NULL;
- entry_attr_find_wsi(e, type, &a);
+ int attr_state = entry_attr_find_wsi(e, type, &a);
/* The attribute is on the present list, or the deleted list and we're doing URP
*/
if ( vals == NULL || vals[0] == NULL )
{
@@ -800,7 +800,7 @@ entry_delete_present_values_wsi_multi_valued(Slapi_Entry *e, const
char *type, s
*/
valueset_purge(&a->a_present_values, csn);
valueset_purge(&a->a_deleted_values, csn);
- if(valueset_isempty(&a->a_present_values))
+ if(attr_state==ATTRIBUTE_PRESENT &&
valueset_isempty(&a->a_present_values))
entry_present_attribute_to_deleted_attribute(e, a);
}
else
@@ -842,7 +842,7 @@ entry_delete_present_values_wsi_multi_valued(Slapi_Entry *e, const
char *type, s
valuearray_update_csn(valuestodelete,CSN_TYPE_VALUE_DELETED,csn);
slapi_valueset_add_attr_valuearray_ext (a, &a->a_deleted_values,
valuestodelete, valuearray_count(valuestodelete), SLAPI_VALUE_FLAG_PASSIN, NULL);
- if(valueset_isempty(&a->a_present_values))
+ if(attr_state==ATTRIBUTE_PRESENT &&
valueset_isempty(&a->a_present_values))
entry_present_attribute_to_deleted_attribute(e, a);
/* all the elements in valuestodelete are passed;
* should free valuestodelete only (don't call valuearray_free)