From 107be3d9186d5cdc000181a41abed56d2ca76252 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 15 Jun 2011 15:02:06 +0000
Subject: [PATCH] Fix OPENDJ-187: ldapsearch tool does not hide the password in the command line

---
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java |  132 +------------------------------------------
 1 files changed, 5 insertions(+), 127 deletions(-)

diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
index 04fc6de..478d2a0 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2010 Sun Microsystems, Inc.
+ *      Portions copyright 2011 ForgeRock AS
  */
 
 package com.forgerock.opendj.ldap.tools;
@@ -34,9 +35,6 @@
 import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
-import java.io.InputStream;
-import java.io.OutputStream;
-
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.*;
 import org.forgerock.opendj.ldap.controls.Control;
@@ -70,145 +68,25 @@
    */
   public static void main(final String[] args)
   {
-    final int retCode = mainPasswordModify(args, System.in, System.out,
-        System.err);
+    final int retCode = new LDAPPasswordModify().run(args);
     System.exit(filterExitCode(retCode));
   }
 
 
 
-  /**
-   * Parses the command-line arguments, establishes a connection to the
-   * Directory Server, sends the password modify request, and reads the
-   * response.
-   *
-   * @param args
-   *          The command-line arguments provided to this program.
-   * @return An integer value of zero if everything completed successfully, or a
-   *         nonzero value if an error occurred.
-   */
-  static int mainPasswordModify(final String[] args)
-  {
-    return mainPasswordModify(args, System.in, System.out, System.err);
-  }
-
-
-
-  /**
-   * Parses the provided command-line arguments and uses that information to run
-   * the LDAPPasswordModify tool.
-   *
-   * @param args
-   *          The command-line arguments provided to this program. specified,
-   *          the number of matching entries should be returned or not.
-   * @param inStream
-   *          The input stream to use for standard input, or <CODE>null</CODE>
-   *          if standard input is not needed.
-   * @param outStream
-   *          The output stream to use for standard output, or <CODE>null</CODE>
-   *          if standard output is not needed.
-   * @param errStream
-   *          The output stream to use for standard error, or <CODE>null</CODE>
-   *          if standard error is not needed.
-   * @return The error code.
-   */
-  static int mainPasswordModify(final String[] args,
-      final InputStream inStream, final OutputStream outStream,
-      final OutputStream errStream)
-  {
-    return new LDAPPasswordModify(inStream, outStream, errStream).run(args);
-  }
-
-
-
   private BooleanArgument verbose;
 
 
 
-  private LDAPPasswordModify(final InputStream in, final OutputStream out,
-      final OutputStream err)
+  private LDAPPasswordModify()
   {
-    super(in, out, err);
-
+    // Nothing to do.
   }
 
 
 
   /**
-   * Indicates whether or not the user has requested advanced mode.
-   *
-   * @return Returns <code>true</code> if the user has requested advanced mode.
-   */
-  @Override
-  public boolean isAdvancedMode()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether or not the user has requested interactive behavior.
-   *
-   * @return Returns <code>true</code> if the user has requested interactive
-   *         behavior.
-   */
-  @Override
-  public boolean isInteractive()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether or not this console application is running in its
-   * menu-driven mode. This can be used to dictate whether output should go to
-   * the error stream or not. In addition, it may also dictate whether or not
-   * sub-menus should display a cancel option as well as a quit option.
-   *
-   * @return Returns <code>true</code> if this console application is running in
-   *         its menu-driven mode.
-   */
-  @Override
-  public boolean isMenuDrivenMode()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether or not the user has requested quiet output.
-   *
-   * @return Returns <code>true</code> if the user has requested quiet output.
-   */
-  @Override
-  public boolean isQuiet()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether or not the user has requested script-friendly output.
-   *
-   * @return Returns <code>true</code> if the user has requested script-friendly
-   *         output.
-   */
-  @Override
-  public boolean isScriptFriendly()
-  {
-    return false;
-  }
-
-
-
-  /**
-   * Indicates whether or not the user has requested verbose output.
-   *
-   * @return Returns <code>true</code> if the user has requested verbose output.
+   * {@inheritDoc}
    */
   @Override
   public boolean isVerbose()

--
Gitblit v1.10.0