From 343e9de6f8f2bbf0ae32b8bd140964583fefd825 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Tue, 20 Oct 2009 15:57:03 +0000
Subject: [PATCH] - RFC 3672 Subentries Control implementation : make earlier drafts based implementation obsolete; keep ldapSubEntry OC search matching criteria for backward compatibility.

---
 opends/src/server/org/opends/server/core/SearchOperationBasis.java |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/SearchOperationBasis.java b/opends/src/server/org/opends/server/core/SearchOperationBasis.java
index 13c5257..5a8d35f 100644
--- a/opends/src/server/org/opends/server/core/SearchOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/SearchOperationBasis.java
@@ -609,26 +609,35 @@
 
     // Determine whether the provided entry is a subentry and if so whether it
     // should be returned.
-    if ((getScope() != SearchScope.BASE_OBJECT) &&
-        (! isReturnLDAPSubentries()) &&
-        entry.isLDAPSubentry())
+    if (entry.isLDAPSubentry())
     {
-      // Check to see if the filter contains an equality element with the
-      // objectclass attribute type and a value of "ldapSubentry".  If so, then
-      // we'll return it anyway.  Technically, this isn't part of the
-      // specification so we don't need to get carried away with really in-depth
-      // checks.
-      checkFilterForLDAPSubEntry(getFilter(), 0);
-
-      if (! isReturnLDAPSubentries())
+      if ((getScope() != SearchScope.BASE_OBJECT) &&
+              (! isReturnLDAPSubentries()))
       {
-        // We still shouldn't return it even based on the filter.  Just throw it
-        // away without doing anything.
+        // Check to see if the filter contains an equality element with the
+        // objectclass attribute type and a value of "ldapSubentry".  If so,
+        // then we'll return it anyway.  Technically, this isn't part of the
+        // specification so we don't need to get carried away with really in
+        // depth checks. Just do best effort for earlier draft compatibility.
+        checkFilterForLDAPSubEntry(getFilter(), 0);
+
+        if (! isReturnLDAPSubentries())
+        {
+          // We still shouldn't return it even based on the filter.
+          // Just throw it away without doing anything.
+          return true;
+        }
+      }
+    }
+    else
+    {
+      if (isReturnLDAPSubentries())
+      {
+        // Subentries are visible and normal entries are not.
         return true;
       }
     }
 
-
     // Determine whether to include the account usable control.  If so, then
     // create it now.
     if (isIncludeUsableControl())

--
Gitblit v1.10.0