From b1693fdfd35f1c5c9c178d98d59cca54c71ebe4a Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 11 Feb 2009 03:29:00 +0000
Subject: [PATCH] Add options displayCommand and commandFilePath to the dsreplication command-line.  These options display the equivalent non-interactive command-line when dsreplication is run in interactive mode (they are the same options already provided by dsconfig).  The WIKI content has already been updated to reflect these changes.

---
 opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java b/opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
index ed2d41c..cb376ab 100644
--- a/opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
+++ b/opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008 Sun Microsystems, Inc.
+ *      Copyright 2008-2009 Sun Microsystems, Inc.
  */
 
 package org.opends.server.util.cli;
@@ -677,7 +677,29 @@
               .unableToReadConnectionParameters(e);
         }
       }
-      if (useAdmin)
+      if (useAdminOrBindDn)
+      {
+        boolean addAdmin = providedAdminUID != null;
+        boolean addBindDN = providedBindDN != null;
+        if (!addAdmin && !addBindDN)
+        {
+          addAdmin = getAdministratorUID() != null;
+          addBindDN = getBindDN() != null;
+        }
+        if (addAdmin)
+        {
+          copySecureArgsList.adminUidArg.clearValues();
+          copySecureArgsList.adminUidArg.addValue(getAdministratorUID());
+          commandBuilder.addArgument(copySecureArgsList.adminUidArg);
+        }
+        else if (addBindDN)
+        {
+          copySecureArgsList.bindDnArg.clearValues();
+          copySecureArgsList.bindDnArg.addValue(getBindDN());
+          commandBuilder.addArgument(copySecureArgsList.bindDnArg);
+        }
+      }
+      else if (useAdmin)
       {
         copySecureArgsList.adminUidArg.clearValues();
         copySecureArgsList.adminUidArg.addValue(getAdministratorUID());
@@ -696,6 +718,7 @@
       adminUID = null;
     }
 
+    boolean addedPasswordFileArgument = false;
     bindPassword = secureArgsList.bindPasswordArg.getValue();
     if (keyManager == null)
     {
@@ -718,7 +741,8 @@
         copySecureArgsList.bindPasswordFileArg.clearValues();
         copySecureArgsList.bindPasswordFileArg.getNameToValueMap().putAll(
             secureArgsList.bindPasswordFileArg.getNameToValueMap());
-        commandBuilder.addArgument(secureArgsList.bindPasswordFileArg);
+        commandBuilder.addArgument(copySecureArgsList.bindPasswordFileArg);
+        addedPasswordFileArgument = true;
       }
       else if (bindPassword == null || bindPassword.equals("-"))
       {
@@ -761,8 +785,11 @@
       }
       copySecureArgsList.bindPasswordArg.clearValues();
       copySecureArgsList.bindPasswordArg.addValue(bindPassword);
-      commandBuilder.addObfuscatedArgument(
+      if (!addedPasswordFileArgument)
+      {
+        commandBuilder.addObfuscatedArgument(
           copySecureArgsList.bindPasswordArg);
+      }
     }
   }
 

--
Gitblit v1.10.0