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

floblanc
21.14.2009 5bef97a9af102ed081c0fc9ff10b8bf743b8f815
Fix issue 3733 root DSE: namingContexts attribute depends on the network group
When performing a search on the root DSE to retrieve the list of namingContexts, only the public naming contexts visible through the current network group should be displayed.
1 files modified
35 ■■■■■ changed files
opends/src/server/org/opends/server/backends/RootDSEBackend.java 35 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/RootDSEBackend.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.backends;
@@ -51,6 +51,8 @@
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.WorkflowTopologyNode;
import org.opends.server.core.networkgroups.NetworkGroup;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.protocols.asn1.ASN1OctetString;
import org.opends.server.types.*;
@@ -769,6 +771,34 @@
  /**
   * Retrieves the root DSE entry for the given network group.
   *
   * @param   ng  The network group for which we want the root DSE entry
   * @return  The root DSE entry for the given network group.
   */
  public Entry getRootDSE(NetworkGroup ng)
  {
    Entry e = getRootDSE();
    // Simply replace the list of naming contexts with those known by
    // the provided network group.
    TreeSet<DN> dn = new TreeSet<DN>();
    for (WorkflowTopologyNode node :
        ng.getNamingContexts().getPublicNamingContexts()) {
      dn.add(node.getBaseDN());
    }
    Attribute publicNamingContextAttr =
         createDNAttribute(ATTR_NAMING_CONTEXTS, ATTR_NAMING_CONTEXTS_LC, dn);
    e.replaceAttribute(publicNamingContextAttr);
    return e;
  }
  /**
   * }
   * Creates an attribute for the root DSE with the following criteria.
   *
   * @param  name       The name for the attribute.
@@ -969,7 +999,8 @@
    switch (searchOperation.getScope())
    {
      case BASE_OBJECT:
        Entry dseEntry = getRootDSE();
        Entry dseEntry = getRootDSE(
            searchOperation.getClientConnection().getNetworkGroup());
        if (filter.matchesEntry(dseEntry))
        {
          searchOperation.returnEntry(dseEntry, null);