From b6eedd3df7f60004e2b1788f3bc1227d230b3999 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 17 Oct 2007 22:13:41 +0000
Subject: [PATCH] Fix for issue Issue 2457: QuickSetup should correlate LDAP and LDAPS ports For the proposed LDAPS port, try to see if we can propose the correlated port with the one LDAP port we are proposing.

---
 opends/src/quicksetup/org/opends/quicksetup/UserData.java |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/UserData.java b/opends/src/quicksetup/org/opends/quicksetup/UserData.java
index 08e406c..4a0e72d 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/UserData.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/UserData.java
@@ -130,7 +130,7 @@
           new HashSet<SuffixDescriptor>());
     setSuffixesToReplicateOptions(suffixes);
     SecurityOptions sec = SecurityOptions.createNoCertificateOptions();
-    sec.setSslPort(getDefaultSslPort());
+    sec.setSslPort(getDefaultSslPort(defaultPort));
     setSecurityOptions(sec);
 
     remoteWithNoReplicationPort =
@@ -543,17 +543,25 @@
    * Provides the port that will be proposed to the user in the security dialog
    *  of the installation wizard. It will check whether we can use ports of type
    * X636 and if not it will return -1.
+   * @param defaultLdapPort the default port used for LDAP.
    *
    * @return the free port of type X636 if it is available and we can use and -1
    * if not.
    */
-  static int getDefaultSslPort()
+  static int getDefaultSslPort(int defaultLdapPort)
   {
     int defaultPort = -1;
 
+    int port = defaultLdapPort - 389 + 636;
+    // Try first with the correlated port of the default LDAP port.
+    if (Utils.canUseAsPort(port))
+    {
+      defaultPort = port;
+    }
+
     for (int i=0;i<10000 && (defaultPort == -1);i+=1000)
     {
-      int port = i + 636;
+      port = i + 636;
       if (Utils.canUseAsPort(port))
       {
         defaultPort = port;

--
Gitblit v1.10.0