From c0144353899d1191c10de1d50e60036e508d5189 Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Tue, 10 Oct 2006 22:42:30 +0000
Subject: [PATCH] Fixes for the following issues, reviewed by neil_a_wilson. issue 776: Overflow of large values for time limit. issue 781: search result entries have their object class in the wrong field.

---
 opends/src/server/org/opends/server/core/SearchOperation.java |   46 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/SearchOperation.java b/opends/src/server/org/opends/server/core/SearchOperation.java
index fbc7ff1..37c59cc 100644
--- a/opends/src/server/org/opends/server/core/SearchOperation.java
+++ b/opends/src/server/org/opends/server/core/SearchOperation.java
@@ -944,9 +944,15 @@
           {
             // First, add the objectclass attribute.
             Attribute ocAttr = entry.getObjectClassAttribute();
-            List<Attribute> ocList = new ArrayList<Attribute>(1);
-            ocList.add(ocAttr);
-            entryToReturn.putAttribute(ocAttr.getAttributeType(), ocList);
+            try
+            {
+              entryToReturn.setObjectClasses(ocAttr.getValues());
+            }
+            catch (DirectoryException e)
+            {
+              // We cannot get this exception because the object classes have
+              // already been validated in the entry they came from.
+            }
 
 
             // Next iterate through all the user attributes and include them.
@@ -1125,18 +1131,34 @@
         }
         else
         {
-          List<Attribute> attrList = entry.getAttribute(attrType, options);
-          if (attrList != null)
+          if (attrType.isObjectClassType() && !typesOnly)
           {
-            if (typesOnly)
+            Attribute ocAttr = entry.getObjectClassAttribute();
+            try
             {
-              attrList = new ArrayList<Attribute>(1);
-              attrList.add(new Attribute(attrType));
-              entryToReturn.putAttribute(attrType, attrList);
+              entryToReturn.setObjectClasses(ocAttr.getValues());
             }
-            else
+            catch (DirectoryException e)
             {
-              entryToReturn.putAttribute(attrType, attrList);
+              // We cannot get this exception because the object classes have
+              // already been validated in the entry they came from.
+            }
+          }
+          else
+          {
+            List<Attribute> attrList = entry.getAttribute(attrType, options);
+            if (attrList != null)
+            {
+              if (typesOnly)
+              {
+                attrList = new ArrayList<Attribute>(1);
+                attrList.add(new Attribute(attrType));
+                entryToReturn.putAttribute(attrType, attrList);
+              }
+              else
+              {
+                entryToReturn.putAttribute(attrType, attrList);
+              }
             }
           }
         }
@@ -1564,7 +1586,7 @@
     else
     {
       // FIXME -- Factor in the user's effective time limit.
-      timeLimitExpiration = processingStartTime + (1000 * timeLimit);
+      timeLimitExpiration = processingStartTime + (1000L * timeLimit);
     }
 
 

--
Gitblit v1.10.0