From 5bef97a9af102ed081c0fc9ff10b8bf743b8f815 Mon Sep 17 00:00:00 2001
From: floblanc <floblanc@localhost>
Date: Wed, 21 Jan 2009 14:14:11 +0000
Subject: [PATCH] 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.
---
opends/src/server/org/opends/server/backends/RootDSEBackend.java | 35 +++++++++++++++++++++++++++++++++--
1 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/RootDSEBackend.java b/opends/src/server/org/opends/server/backends/RootDSEBackend.java
index c2c4bed..475d54a 100644
--- a/opends/src/server/org/opends/server/backends/RootDSEBackend.java
+++ b/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);
--
Gitblit v1.10.0