From 4ac4b275bdde78a84b8330e421ce54b11e981049 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Fri, 30 Jul 2010 13:40:30 +0000
Subject: [PATCH] Fix issue 4573 - Admin Connector certificate should use the host name provided by the user in setup. This is achieved by storing the specified hostname in a temporary file under cn=config, which will be used for generating the self-signed certificates and then deleted. If changing or deleting the self-signed certificates, the provided host name is lost and must be manually specified again.

---
 opends/src/server/org/opends/server/backends/TrustStoreBackend.java |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/TrustStoreBackend.java b/opends/src/server/org/opends/server/backends/TrustStoreBackend.java
index abceec1..7cd1125 100644
--- a/opends/src/server/org/opends/server/backends/TrustStoreBackend.java
+++ b/opends/src/server/org/opends/server/backends/TrustStoreBackend.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2007-2008 Sun Microsystems, Inc.
+ *      Copyright 2007-2010 Sun Microsystems, Inc.
  */
 package org.opends.server.backends;
 
@@ -77,6 +77,7 @@
 import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.types.*;
 import org.opends.server.util.CertificateManager;
+import org.opends.server.util.SetupUtils;
 import org.opends.server.util.Validator;
 
 
@@ -1730,9 +1731,9 @@
   private static String getADSCertificateSubjectDN()
        throws UnknownHostException
   {
-    String hostname =
-         java.net.InetAddress.getLocalHost().getCanonicalHostName();
-    return "cn=" + Rdn.escapeValue(hostname) + ",O=OpenDS Certificate";
+    String hostName =
+      SetupUtils.getHostNameForCertificate(DirectoryServer.getServerRoot());
+    return "cn=" + Rdn.escapeValue(hostName) + ",O=OpenDS Certificate";
   }
 
   /**
@@ -1874,6 +1875,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void preloadEntryCache() throws UnsupportedOperationException {
     throw new UnsupportedOperationException("Operation not supported.");
   }

--
Gitblit v1.10.0