From 5d8bdf3c45ba5425410a8ca278ae6df9655f3c71 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Fri, 14 Dec 2007 09:51:02 +0000
Subject: [PATCH] Fix for issue #2648 (dsconfig/dsreplication do not work with ipv6 address): Before creating the ldapURL, check if we have an IPv6 address

---
 opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java b/opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java
index 00ca737..8cd4c5b 100644
--- a/opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java
+++ b/opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java
@@ -47,6 +47,7 @@
 import javax.naming.ldap.LdapName;
 import javax.naming.ldap.Rdn;
 
+import org.opends.admin.ads.util.ConnectionUtils;
 import org.opends.server.admin.client.AuthenticationException;
 import org.opends.server.admin.client.AuthenticationNotSupportedException;
 import org.opends.server.admin.client.CommunicationException;
@@ -101,7 +102,8 @@
     env
         .put(Context.INITIAL_CONTEXT_FACTORY,
             "com.sun.jndi.ldap.LdapCtxFactory");
-    env.put(Context.PROVIDER_URL, "ldap://" + host + ":" + port);
+    String hostname = ConnectionUtils.getHostNameForLdapUrl(host) ;
+    env.put(Context.PROVIDER_URL, "ldap://" + hostname + ":" + port);
     env.put(Context.SECURITY_PRINCIPAL, name);
     env.put(Context.SECURITY_CREDENTIALS, password);
 

--
Gitblit v1.10.0