ldap/servers/slapd/valueset.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit 246527f4c01d32289e0082083d364563af59635a
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jan 28 10:36:40 2010 -0800
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.
diff --git a/ldap/servers/slapd/valueset.c b/ldap/servers/slapd/valueset.c
index 3df302f..7334a7a 100644
--- a/ldap/servers/slapd/valueset.c
+++ b/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;