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

Matthew Swift
14.35.2011 f571f9d7e26584b4e25ad6f113d090ba9e86d0ac
Fix OPENDJ-280: Add support for the LDAP sub-entry control as defined in draft-ietf-ldup-subentry
5 files modified
49 ■■■■■ changed files
opends/src/server/org/opends/server/core/DirectoryServer.java 1 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/ServerConstants.java 13 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java 5 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendSearchOperation.java 5 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java 25 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -2607,6 +2607,7 @@
    supportedControls.add(OID_AUTHZID_REQUEST);
    supportedControls.add(OID_MATCHED_VALUES);
    supportedControls.add(OID_LDAP_SUBENTRIES);
    supportedControls.add(OID_LDUP_SUBENTRIES);
    supportedControls.add(OID_PASSWORD_POLICY_CONTROL);
    supportedControls.add(OID_PERMISSIVE_MODIFY_CONTROL);
    supportedControls.add(OID_REAL_ATTRS_ONLY);
opends/src/server/org/opends/server/util/ServerConstants.java
@@ -2273,14 +2273,23 @@
  /**
   * The OID for the LDAP subentries control used to indicate that matching
   * subentries should be returned.
   * The OID for the LDAP subentries control as defined in RFC 3672, which is
   * used to indicate that matching subentries should be returned.
   */
  public static final String OID_LDAP_SUBENTRIES = "1.3.6.1.4.1.4203.1.10.1";
  /**
   * The OID for the LDAP subentries control as defined in the legacy
   * draft-ietf-ldup-subentry internet draft, which is used to indicate that
   * matching subentries should be returned.
   */
  public static final String OID_LDUP_SUBENTRIES = "1.3.6.1.4.1.7628.5.101.1";
  /**
   * The OID for the matched values control used to specify which particular
   * attribute values should be returned in a search result entry.
   */
opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java
@@ -547,6 +547,11 @@
                  getRequestControl(SubentriesControl.DECODER);
          setReturnSubentriesOnly(subentriesControl.getVisibility());
        }
        else if (oid.equals(OID_LDUP_SUBENTRIES))
        {
          // Support for legacy draft-ietf-ldup-subentry.
          setReturnSubentriesOnly(true);
        }
        else if (oid.equals(OID_MATCHED_VALUES))
        {
          MatchedValuesControl matchedValuesControl =
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendSearchOperation.java
@@ -515,6 +515,11 @@
                  getRequestControl(SubentriesControl.DECODER);
          setReturnSubentriesOnly(subentriesControl.getVisibility());
        }
        else if (oid.equals(OID_LDUP_SUBENTRIES))
        {
          // Support for legacy draft-ietf-ldup-subentry.
          setReturnSubentriesOnly(true);
        }
        else if (oid.equals(OID_MATCHED_VALUES))
        {
          MatchedValuesControl matchedValuesControl =
opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
@@ -28,6 +28,7 @@
package org.opends.server.core;
import static org.opends.server.util.ServerConstants.OID_LDUP_SUBENTRIES;
import static org.testng.Assert.*;
import java.io.IOException;
@@ -946,6 +947,30 @@
  }
  @Test
  public void testSearchInternalLegacySubEntryControl() throws Exception
  {
    InvocationCounterPlugin.resetAllCounters();
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    InternalSearchOperation searchOperation = new InternalSearchOperation(conn,
        InternalClientConnection.nextOperationID(),
        InternalClientConnection.nextMessageID(),
        Collections.singletonList((Control) new LDAPControl(
            OID_LDUP_SUBENTRIES, true)), ByteString.valueOf(BASE),
        SearchScope.WHOLE_SUBTREE, DereferencePolicy.NEVER_DEREF_ALIASES,
        Integer.MAX_VALUE, Integer.MAX_VALUE, false,
        LDAPFilter.decode("(objectclass=*)"), null, null);
    searchOperation.run();
    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
    assertEquals(searchOperation.getEntriesSent(), 1);
    assertEquals(searchOperation.getErrorMessage().length(), 0);
  }
  @Test
  public void testSearchInternalSubEntryAndFilter() throws Exception
  {
    InvocationCounterPlugin.resetAllCounters();