Pārlūkot izejas kodu

389 DS segfaults on libsyntax-plugin.so - part 2

https://bugzilla.redhat.com/show_bug.cgi?id=516611
Resolves: bug 516611
Bug Description: 389 DS segfaults on libsyntax-plugin.so - part 2
Reviewed by: nkinder (Thanks!)
Branch: HEAD
Fix Description: If there is an empty mod/replace of a non-existent attribute
following a real modify operation, the server will allow it, and the code in
entry_delete_present_values_wsi() would create an empty Slapi_Attr.  LDAP
says that an empty mod/replace of a non-existent attribute should be ignored,
as it is in the non-repl case.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 15 gadi atpakaļ
vecāks
revīzija
38d13f961c
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 3 1
      ldap/servers/slapd/entrywsi.c

+ 3 - 1
ldap/servers/slapd/entrywsi.c

@@ -646,7 +646,9 @@ entry_delete_present_values_wsi(Slapi_Entry *e, const char *type, struct berval
 			LDAPDebug( LDAP_DEBUG_ARGS, "could not find attribute %s\n", type, 0, 0 );
 		}
 		retVal= LDAP_NO_SUCH_ATTRIBUTE;
-		if (LDAP_MOD_REPLACE == mod_op)
+		/* NOTE: LDAP says that a MOD REPLACE with no vals of a non-existent
+		   attribute is a no-op - MOD REPLACE with some vals will add the attribute */
+		if ((LDAP_MOD_REPLACE == mod_op) && vals && vals[0])
 		{
 			/* Create a new attribute and set the adcsn */
 			Slapi_Attr *a = slapi_attr_new();