From a35f8a47cca3dbdb584cad85c5aa61f27e0bf42a Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Sat, 07 Oct 2006 02:48:40 +0000
Subject: [PATCH] Fix a bug that allows the server to overlook the fact that there are duplicate values in an LDAP attribute when converting to a core Attribute (it would silently discard the duplicate rather than rejecting it).

---
 opends/src/server/org/opends/server/protocols/ldap/LDAPAttribute.java |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPAttribute.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPAttribute.java
index 280e72d..2ea3357 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPAttribute.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPAttribute.java
@@ -365,7 +365,13 @@
          new LinkedHashSet<AttributeValue>(values.size());
     for (ASN1OctetString value : values)
     {
-      attributeValues.add(new AttributeValue(attrType, value));
+      if (! attributeValues.add(new AttributeValue(attrType, value)))
+      {
+        int    msgID   = MSGID_LDAP_ATTRIBUTE_DUPLICATE_VALUES;
+        String message = getMessage(msgID, attributeType);
+        throw new LDAPException(LDAPResultCode.ATTRIBUTE_OR_VALUE_EXISTS, msgID,
+                                message);
+      }
     }
 
 

--
Gitblit v1.10.0