Jelajahi Sumber

247413 - Incorrect error on multiple identical value add

https://bugzilla.redhat.com/show_bug.cgi?id=247413

[Problem Description] Adding multiple identical values returns
"Operations error (LDAP_OPERATIONS_ERROR == 0x1)" instead of
"Type or value exists (LDAP_TYPE_OR_VALUE_EXISTS == 0x14)"
E.g.,
  dn: ou=test,dc=example,dc=com
  changetype: modify
  replace: description
  description: test
  description: test

  modifying entry "ou=test,dc=example,dc=com"
  ldap_modify: Operations error (1)

[Fix Description] API valueset_replace used to override any
error from the lower layer with LDAP_OPERATIONS_ERROR. If
the error is LDAP_TYPE_OR_VALUE_EXISTS, the error is now
returned as is.
Noriko Hosoi 16 tahun lalu
induk
melakukan
246527f4c0
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 3 1
      ldap/servers/slapd/valueset.c

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

@@ -1358,7 +1358,9 @@ valueset_replace(Slapi_Attr *a, Slapi_ValueSet *vs, Slapi_Value **valstoreplace)
         Avlnode *vtree = NULL;
         rc = valuetree_add_valuearray( a->a_type, a->a_plugin, valstoreplace, &vtree, NULL );
         valuetree_free(&vtree);
-        if ( LDAP_SUCCESS != rc )
+        if ( LDAP_SUCCESS != rc &&
+             /* bz 247413: don't override LDAP_TYPE_OR_VALUE_EXISTS */
+             LDAP_TYPE_OR_VALUE_EXISTS != rc )
         {
             /* There were already duplicate values in the value set */
             rc = LDAP_OPERATIONS_ERROR;