From 21ee5a44d30731fef7efe5744667d3acf44823cf Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Wed, 05 Sep 2007 12:14:16 +0000
Subject: [PATCH] - remove useless test - fix a buf (we don't need bindDN if client side authentication is required)

---
 opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java |   82 ++++++++++++++++++++++++-----------------
 1 files changed, 48 insertions(+), 34 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java b/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java
index 3bb6f92..b542241 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java
@@ -207,17 +207,15 @@
         }
       }
 
-      if (secureConnection)
+      if (useSSL || useStartTSL)
       {
-        if (useSSL || useStartTSL)
-        {
-          // Get truststore info
-          trustManager = getTrustManager();
+        // Get truststore info
+        trustManager = getTrustManager();
 
-          // Check if we need client side authentication
-          keyManager = getKeyManager();
-        }
+        // Check if we need client side authentication
+        keyManager = getKeyManager();
       }
+
       // Get the LDAP host.
       String hostName = secureArgsList.hostNameArg.getValue();
       final String tmpHostName = hostName;
@@ -326,38 +324,54 @@
       // Get the LDAP bind credentials.
       String bindDN = secureArgsList.bindDnArg.getValue();
       final String tmpBindDN = bindDN;
-      if (app.isInteractive() && (keyManager == null)
-          && !secureArgsList.bindDnArg.isPresent())
+      if (keyManager == null)
       {
-        if (!isHeadingDisplayed) {
-          app.println();
-          app.println();
-          app.println(INFO_DSCFG_HEADING_CONNECTION_PARAMETERS.get());
-          isHeadingDisplayed = true;
-        }
-
-        ValidationCallback<String> callback = new ValidationCallback<String>() {
-
-          public String validate(ConsoleApplication app, String input)
-              throws CLIException {
-            String ninput = input.trim();
-            if (ninput.length() == 0) {
-              return tmpBindDN;
-            } else {
-              return ninput;
-            }
+        if (app.isInteractive() && !secureArgsList.bindDnArg.isPresent())
+        {
+          if (!isHeadingDisplayed)
+          {
+            app.println();
+            app.println();
+            app.println(INFO_DSCFG_HEADING_CONNECTION_PARAMETERS.get());
+            isHeadingDisplayed = true;
           }
 
-        };
+          ValidationCallback<String> callback = new ValidationCallback<String>()
+          {
 
-        try {
-          app.println();
-          bindDN = app.readValidatedInput(
-              INFO_DSCFG_PROMPT_BIND_DN.get(bindDN), callback);
-        } catch (CLIException e) {
-          throw ArgumentExceptionFactory.unableToReadConnectionParameters(e);
+            public String validate(ConsoleApplication app, String input)
+                throws CLIException
+            {
+              String ninput = input.trim();
+              if (ninput.length() == 0)
+              {
+                return tmpBindDN;
+              }
+              else
+              {
+                return ninput;
+              }
+            }
+
+          };
+
+          try
+          {
+            app.println();
+            bindDN = app.readValidatedInput(INFO_DSCFG_PROMPT_BIND_DN
+                .get(bindDN), callback);
+          }
+          catch (CLIException e)
+          {
+            throw ArgumentExceptionFactory
+                .unableToReadConnectionParameters(e);
+          }
         }
       }
+      else
+      {
+        bindDN = null ;
+      }
 
       String bindPassword = secureArgsList.bindPasswordArg.getValue();
       if (keyManager == null)

--
Gitblit v1.10.0