1
0
Эх сурвалжийг харах

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: richm, thanks
Ludwig Krispenz 12 жил өмнө
parent
commit
2cc32e62b6

+ 4 - 2
ldap/servers/slapd/entrywsi.c

@@ -785,7 +785,9 @@ entry_delete_present_values_wsi_multi_valued(Slapi_Entry *e, const char *type, s
 {
 	int retVal= LDAP_SUCCESS;
 	Slapi_Attr *a= NULL;
+	int attr_state;
 	entry_attr_find_wsi(e, type, &a);
+	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 +802,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 +844,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)