From 361ef6863dfd06dbe100e2c982dfd7cd89f82a0b Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 23 Jan 2008 17:57:49 +0000
Subject: [PATCH] Use the adress specified in the configuration instead of "localhost" as LDAP URLs.
---
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java
index 5986cb7..040e019 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2007 Sun Microsystems, Inc.
+ * Portions Copyright 2007-2008 Sun Microsystems, Inc.
*/
package org.opends.guitools.statuspanel;
@@ -38,6 +38,7 @@
import org.opends.server.core.DirectoryServer;
import org.opends.admin.ads.ADSContext;
+import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.messages.Message;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
@@ -242,6 +243,7 @@
if (desc.getState() == ListenerDescriptor.State.ENABLED)
{
int port = -1;
+ String host = "localhost";
try
{
String addressPort = desc.getAddressPort();
@@ -249,6 +251,10 @@
if (index != -1)
{
port = Integer.parseInt(addressPort.substring(index+1));
+ if (index > 0)
+ {
+ host = addressPort.substring(0, index);
+ }
}
else
{
@@ -262,7 +268,7 @@
if (port != -1)
{
- url = "ldap://localhost:"+port;
+ url = "ldap://"+ConnectionUtils.getHostNameForLdapUrl(host)+":"+port;
break;
}
}
@@ -363,6 +369,7 @@
{
int port = -1;
+ String host = "localhost";
try
{
String addressPort = desc.getAddressPort();
@@ -370,6 +377,10 @@
if (index != -1)
{
port = Integer.parseInt(addressPort.substring(index+1));
+ if (index > 0)
+ {
+ host = addressPort.substring(0, index);
+ }
}
else
{
@@ -386,13 +397,15 @@
if (!secure &&
(desc.getProtocol() == ListenerDescriptor.Protocol.LDAP))
{
- url = "ldap://localhost:"+port;
+ url = "ldap://"+ConnectionUtils.getHostNameForLdapUrl(host)+":"+
+ port;
break;
}
if (secure &&
(desc.getProtocol() == ListenerDescriptor.Protocol.LDAPS))
{
- url = "ldaps://localhost:"+port;
+ url = "ldaps://"+ConnectionUtils.getHostNameForLdapUrl(host)+":"+
+ port;
break;
}
}
--
Gitblit v1.10.0