mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
15.03.2006 aad7f10021cdc6bb66a88daa4a4703ea9449fc9b
Update the search operation to support returning entries containing the
ldapSubEntry objectclass if the filter explicitly contains an
"(objectClass=ldapSubEntry)" component.

OpenDS Issue Number: 1107
1 files modified
46 ■■■■■ changed files
opends/src/server/org/opends/server/core/SearchOperation.java 46 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/SearchOperation.java
@@ -64,6 +64,7 @@
import org.opends.server.types.DisconnectReason;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.FilterType;
import org.opends.server.types.OperationType;
import org.opends.server.types.ResultCode;
import org.opends.server.types.SearchFilter;
@@ -842,9 +843,48 @@
    if ((scope != SearchScope.BASE_OBJECT) && (! returnLDAPSubentries) &&
        entry.isLDAPSubentry())
    {
      // This is a subentry and we should not return it to the client.  Just
      // throw it away without doing anything.
      return true;
      // 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.
      switch (filter.getFilterType())
      {
        case AND:
        case OR:
          for (SearchFilter f : filter.getFilterComponents())
          {
            if ((f.getFilterType() == FilterType.EQUALITY) &&
                (f.getAttributeType().isObjectClassType()))
            {
              AttributeValue v = f.getAssertionValue();
              if (toLowerCase(v.getStringValue()).equals("ldapsubentry"))
              {
                returnLDAPSubentries = true;
              }
              break;
            }
          }
          break;
        case EQUALITY:
          AttributeType t = filter.getAttributeType();
          if (t.isObjectClassType())
          {
            AttributeValue v = filter.getAssertionValue();
            if (toLowerCase(v.getStringValue()).equals("ldapsubentry"))
            {
              returnLDAPSubentries = true;
            }
          }
          break;
      }
      if (! returnLDAPSubentries)
      {
        // We still shouldn't return it even based on the filter.  Just throw it
        // away without doing anything.
        return true;
      }
    }