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

jvergara
04.46.2008 a9f7d133b96f6f35d2f6fa5e2c4926fcfb770378
Fix for issue 3120 (Bad behavior of the status CLI and status panel if 2 LDAP connection handlers)

The issue is not related to the fact that we have several LDAP connection handlers but to the fact that the default listen address (0.0.0.0) is not written to cn=config nor the value is returned when asking for it explicitly through ldapsearch. The fix consists of using the default value if the explicit value of the listen address is not found.
2 files modified
39 ■■■■■ changed files
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java 35 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromLDAP.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java
@@ -28,6 +28,7 @@
package org.opends.guitools.statuspanel;
import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
@@ -36,6 +37,10 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import org.opends.server.admin.DefaultBehaviorProvider;
import org.opends.server.admin.DefinedDefaultBehaviorProvider;
import org.opends.server.admin.IPAddressPropertyDefinition;
import org.opends.server.admin.std.meta.LDAPConnectionHandlerCfgDefn;
import org.opends.server.core.DirectoryServer;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.util.ConnectionUtils;
@@ -415,6 +420,31 @@
  }
  /**
   * Returns the default LDAP address as defined in the configuration.
   * @return the default LDAP address as defined in the configuration.
   */
  static String getDefaultLdapAddress()
  {
    String address = null;
    //  Get default value
    LDAPConnectionHandlerCfgDefn connHandler =
      LDAPConnectionHandlerCfgDefn.getInstance();
    IPAddressPropertyDefinition prop =
      connHandler.getListenAddressPropertyDefinition();
    DefaultBehaviorProvider p = prop.getDefaultBehaviorProvider();
    if (p instanceof DefinedDefaultBehaviorProvider)
    {
      Collection<?> defaultValues =
        ((DefinedDefaultBehaviorProvider)p).getDefaultValues();
      if (!defaultValues.isEmpty())
      {
        address = defaultValues.iterator().next().toString();
      }
    }
    return address;
  }
  /**
   * An convenience method to know if the provided ID corresponds to a
   * configuration backend or not.
   * @param id the backend ID to analyze
@@ -483,6 +513,11 @@
    ListenerDescriptor.State state;
    if (entry.hasObjectClass(ldapConnectionHandlerOc))
    {
      if (address == null)
      {
        address = getDefaultLdapAddress();
      }
      addressPort = address+":"+port;
      if (isSecure)
      {
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromLDAP.java
@@ -849,6 +849,10 @@
    ListenerDescriptor.State state;
    if (hasObjectClass(entry, "ds-cfg-ldap-connection-handler"))
    {
      if (address == null)
      {
        address = ConfigFromFile.getDefaultLdapAddress();
      }
      addressPort = address+":"+port;
      if (isSecure)
      {