mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
06.37.2014 231d7b6cf5fde6c921812ad52877832773392e98
Checkpoint OPENDJ-1343 Migrate dsconfig
- Removed the PasswordReader class as now we only support >JDK6
- Replaced calls to PasswordReader.readPassword to ConsoleApplication.readPassword()
- Minor code cleanup / removed unused on the SecureConnectionCli class.
9 files modified
1 files deleted
669 ■■■■ changed files
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java 257 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java 94 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java 11 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPCompare.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPDelete.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPModify.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPPasswordModify.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPSearch.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/util/PasswordReader.java 264 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/util/args/LDAPConnectionArgumentParser.java 13 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
@@ -27,21 +27,15 @@
package org.opends.server.admin.client.cli;
import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_LONG_ADMIN_UID;
import static com.forgerock.opendj.cli.CliMessages.INFO_DESCRIPTION_ADMIN_PORT;
import static com.forgerock.opendj.cli.CliMessages.*;
import static com.forgerock.opendj.cli.ReturnCode.CONFLICTING_ARGS;
import static com.forgerock.opendj.cli.ReturnCode.SUCCESS;
import static com.forgerock.opendj.cli.Utils.LINE_SEPARATOR;
import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH;
import static org.opends.server.util.StaticUtils.close;
import static org.opends.server.util.StaticUtils.wrapText;
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.forgerock.util.Utils.closeSilently;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetAddress;
import java.security.KeyStore;
import java.security.KeyStoreException;
@@ -50,15 +44,11 @@
import java.util.ArrayList;
import java.util.LinkedHashSet;
import javax.net.ssl.KeyManager;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.admin.ads.util.ApplicationKeyManager;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.quicksetup.Constants;
import org.opends.server.admin.AdministrationConnector;
import org.opends.server.admin.server.ServerManagementContext;
import org.opends.server.admin.std.server.AdministrationConnectorCfg;
@@ -67,12 +57,11 @@
import org.opends.server.admin.std.server.TrustManagerProviderCfg;
import org.opends.server.config.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.util.PasswordReader;
import org.opends.server.util.SelectableCertificateKeyManager;
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.CliConstants;
import com.forgerock.opendj.cli.CommonArguments;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.IntegerArgument;
@@ -265,145 +254,6 @@
  }
  /**
   * Get the password which has to be used for the command.
   *
   * @param dn
   *          The user DN for which to password could be asked.
   * @param out
   *          The input stream to used if we have to prompt to the
   *          user.
   * @param err
   *          The error stream to used if we have to prompt to the
   *          user.
   * @param clearArg
   *          The password StringArgument argument.
   * @param fileArg
   *          The password FileBased argument.
   * @return The password stored into the specified file on by the
   *         command line argument, or prompts it if not specified.
   */
  public String getBindPassword(String dn,
      OutputStream out, OutputStream err, StringArgument clearArg,
      FileBasedArgument fileArg)
  {
    if (clearArg.isPresent())
    {
      String bindPasswordValue = clearArg.getValue();
      if(bindPasswordValue != null && "-".equals(bindPasswordValue))
      {
        // read the password from the stdin.
        try
        {
          out.write(INFO_LDAPAUTH_PASSWORD_PROMPT.get(dn).toString().getBytes());
          out.flush();
          char[] pwChars = PasswordReader.readPassword();
          bindPasswordValue = new String(pwChars);
        } catch(Exception ex)
        {
          logger.traceException(ex);
          try
          {
            err.write(wrapText(ex.getMessage(), MAX_LINE_WIDTH).getBytes());
            err.write(LINE_SEPARATOR.getBytes());
          }
          catch (IOException e)
          {
          }
          return null;
        }
      }
      return bindPasswordValue;
    }
    else
      if (fileArg.isPresent())
      {
        return fileArg.getValue();
      }
      else
      {
        // read the password from the stdin.
        try
        {
          out.write(
              INFO_LDAPAUTH_PASSWORD_PROMPT.get(dn).toString().getBytes());
          out.flush();
          char[] pwChars = PasswordReader.readPassword();
          return new String(pwChars);
        }
        catch (Exception ex)
        {
          logger.traceException(ex);
          try
          {
            err.write(wrapText(ex.getMessage(), MAX_LINE_WIDTH).getBytes());
            err.write(LINE_SEPARATOR.getBytes());
          }
          catch (IOException e)
          {
          }
          return null;
        }
      }
  }
  /**
   * Get the password which has to be used for the command.
   *
   * @param dn
   *          The user DN for which to password could be asked.
   * @param out
   *          The input stream to used if we have to prompt to the
   *          user.
   * @param err
   *          The error stream to used if we have to prompt to the
   *          user.
   * @return The password stored into the specified file on by the
   *         command line argument, or prompts it if not specified.
   */
  public String getBindPassword(String dn, OutputStream out, OutputStream err)
  {
    return getBindPassword(dn, out, err, bindPasswordArg, bindPasswordFileArg);
  }
  /**
   * Get the password which has to be used for the command without prompting
   * the user.  If no password was specified, return null.
   *
   * @param clearArg
   *          The password StringArgument argument.
   * @param fileArg
   *          The password FileBased argument.
   * @return The password stored into the specified file on by the
   *         command line argument, or null it if not specified.
   */
  public String getBindPassword(StringArgument clearArg,
      FileBasedArgument fileArg)
  {
    if (clearArg.isPresent())
    {
      return clearArg.getValue();
    }
    else if (fileArg.isPresent())
    {
      return fileArg.getValue();
    }
    return null;
  }
  /**
   * Get the password which has to be used for the command without prompting
   * the user.  If no password was specified, return null.
   *
   * @return The password stored into the specified file on by the
   *         command line argument, or null it if not specified.
   */
  public String getBindPassword()
  {
    return getBindPassword(bindPasswordArg, bindPasswordFileArg);
  }
  /**
   * Initialize Global option.
   *
   * @throws ArgumentException
@@ -453,7 +303,7 @@
    adminUidArg = new StringArgument("adminUID", 'I',
        OPTION_LONG_ADMIN_UID, false, false, true,
        INFO_ADMINUID_PLACEHOLDER.get(),
        Constants.GLOBAL_ADMIN_UID, null,
        CliConstants.GLOBAL_ADMIN_UID, null,
        INFO_DESCRIPTION_ADMIN_UID.get());
    adminUidArg.setPropertyName(OPTION_LONG_ADMIN_UID);
    adminUidArg.setHidden(true);
@@ -626,23 +476,6 @@
    return SUCCESS.get();
  }
  /**
   * Indication if provided global options are validate.
   *
   * @param err the stream to be used to print error message.
   * @return return code.
   */
  public int validateGlobalOptions(PrintStream err)
  {
    LocalizableMessageBuilder buf = new LocalizableMessageBuilder();
    int returnValue = validateGlobalOptions(buf);
    if (buf.length() > 0)
    {
      err.println(wrapText(buf.toString(), MAX_LINE_WIDTH));
    }
    return returnValue;
  }
  /**
   * Indicate if the SSL mode is required.
@@ -756,7 +589,7 @@
          }
          finally
          {
            close(fos);
            closeSilently(fos);
          }
        }
      trustManager = new ApplicationTrustManager(truststore);
@@ -764,87 +597,7 @@
    return trustManager;
  }
  /**
   * Handle KeyStore.
   *
   * @return The keyStore manager to be used for the command.
   */
  public KeyManager getKeyManager()
  {
    KeyStore keyStore = null;
    String keyStorePasswordStringValue = null;
    char[] keyStorePasswordValue = null;
    if (keyStorePathArg.isPresent())
    {
      FileInputStream fos = null;
      try
      {
        fos = new FileInputStream(keyStorePathArg.getValue());
        if (keyStorePasswordArg.isPresent())
        {
          keyStorePasswordStringValue = keyStorePasswordArg.getValue();
        }
        else if (keyStorePasswordFileArg.isPresent())
        {
          keyStorePasswordStringValue = keyStorePasswordFileArg.getValue();
        }
        if (keyStorePasswordStringValue != null)
        {
          keyStorePasswordValue = keyStorePasswordStringValue.toCharArray();
        }
        keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
        keyStore.load(fos,keyStorePasswordValue);
      }
      catch (KeyStoreException e)
      {
        // Nothing to do: if this occurs we will systematically refuse
        // the certificates. Maybe we should avoid this and be strict, but
        // we are in a best effort mode.
        logger.warn(LocalizableMessage.raw("Error with the keystore"), e);
      }
      catch (NoSuchAlgorithmException e)
      {
        // Nothing to do: if this occurs we will systematically refuse
        // the certificates. Maybe we should avoid this and be strict, but
        // we are in a best effort mode.
        logger.warn(LocalizableMessage.raw("Error with the keystore"), e);
      }
      catch (CertificateException e)
      {
        // Nothing to do: if this occurs we will systematically refuse
        // the certificates. Maybe we should avoid this and be strict, but
        // we are in a best effort mode.
        logger.warn(LocalizableMessage.raw("Error with the keystore"), e);
      }
      catch (IOException e)
      {
        // Nothing to do: if this occurs we will systematically refuse
        // the certificates. Maybe we should avoid this and be strict, but
        // we are in a best effort mode.
        logger.warn(LocalizableMessage.raw("Error with the keystore"), e);
      }
      finally
      {
        close(fos);
      }
      char[] password = null;
      if (keyStorePasswordStringValue != null)
      {
        password = keyStorePasswordStringValue.toCharArray();
      }
      ApplicationKeyManager akm = new ApplicationKeyManager(keyStore,password);
      if (certNicknameArg.isPresent())
      {
        return new SelectableCertificateKeyManager(akm, certNicknameArg
            .getValue());
      }
      return akm;
    }
    return null;
  }
  /**
   * Returns <CODE>true</CODE> if we can read on the provided path and
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
@@ -27,10 +27,11 @@
package org.opends.server.admin.client.cli;
import static org.opends.server.util.ServerConstants.EOL;
import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH;
import static com.forgerock.opendj.cli.CliMessages.*;
import static com.forgerock.opendj.cli.Utils.LINE_SEPARATOR;
import static com.forgerock.opendj.cli.Utils.MAX_LINE_WIDTH;
import static org.opends.server.util.StaticUtils.wrapText;
import static org.opends.messages.ToolMessages.*;
import static com.forgerock.opendj.cli.ReturnCode.CONFLICTING_ARGS;
import java.io.IOException;
import java.io.OutputStream;
@@ -38,19 +39,18 @@
import java.util.Collection;
import java.util.LinkedHashSet;
import javax.net.ssl.KeyManager;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.server.util.PasswordReader;
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentGroup;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.CommonArguments;
import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
@@ -146,59 +146,32 @@
   * @param err
   *          The error stream to used if we have to prompt to the
   *          user.
   * @param clearArg
   * @param pwdArg
   *          The password StringArgument argument.
   * @param fileArg
   *          The password FileBased argument.
   * @return The password stored into the specified file on by the
   *         command line argument, or prompts it if not specified.
   */
  protected String getBindPassword(String dn,
      OutputStream out, OutputStream err, StringArgument clearArg,
      FileBasedArgument fileArg)
  protected String getBindPassword(String dn, OutputStream out,
      OutputStream err, StringArgument pwdArg, FileBasedArgument fileArg)
  {
    if (clearArg.isPresent())
    {
      String bindPasswordValue = clearArg.getValue();
      if(bindPasswordValue != null && "-".equals(bindPasswordValue))
      {
        // read the password from the stdin.
        try
        {
          out.write(INFO_LDAPAUTH_PASSWORD_PROMPT.get(dn).toString().getBytes());
          out.flush();
          char[] pwChars = PasswordReader.readPassword();
          bindPasswordValue = new String(pwChars);
        } catch(Exception ex)
        {
          logger.traceException(ex);
          try
          {
            err.write(wrapText(ex.getMessage(), MAX_LINE_WIDTH).getBytes());
            err.write(EOL.getBytes());
          }
          catch (IOException e)
          {
          }
          return null;
        }
      }
      return bindPasswordValue;
    }
    else
    String bindPasswordValue = null;
    if (fileArg.isPresent())
    {
      return fileArg.getValue();
    }
    else
    else if (pwdArg.isPresent())
    {
      // read the password from the stdin.
      bindPasswordValue = pwdArg.getValue();
    }
    if ((bindPasswordValue != null && "-".equals(bindPasswordValue))
        || bindPasswordValue == null)
    {
      // Read the password from the STDin.
      try
      {
        out.write(INFO_LDAPAUTH_PASSWORD_PROMPT.get(dn).toString().getBytes());
        out.flush();
        char[] pwChars = PasswordReader.readPassword();
        return new String(pwChars);
        return readPassword(dn, out);
      }
      catch (Exception ex)
      {
@@ -206,19 +179,28 @@
        try
        {
          err.write(wrapText(ex.getMessage(), MAX_LINE_WIDTH).getBytes());
          err.write(EOL.getBytes());
          err.write(LINE_SEPARATOR.getBytes());
        }
        catch (IOException e)
        {
          // Nothing to do.
        }
        return null;
      }
    }
    return bindPasswordValue;
  }
  private String readPassword(String dn, OutputStream out) throws IOException,
      ClientException
  {
    out.write(INFO_LDAPAUTH_PASSWORD_PROMPT.get(dn).toString().getBytes());
    out.flush();
    char[] pwChars = ConsoleApplication.readPassword();
    return new String(pwChars);
  }
  /**
   * Get the password which has to be used for the command.
   * Gets the password which has to be used for the command.
   *
   * @param dn
   *          The user DN for which to password could be asked.
@@ -238,7 +220,7 @@
  }
  /**
   * Get the password which has to be used for the command without prompting
   * Gets the password which has to be used for the command without prompting
   * the user.  If no password was specified, return null.
   *
   * @return The password stored into the specified file on by the
@@ -366,10 +348,10 @@
              .getLongIdentifier());
      if (buf.length() > 0)
      {
        buf.append(EOL);
        buf.append(LINE_SEPARATOR);
      }
      buf.append(message);
      ret = 1;
      return CONFLICTING_ARGS.get();
    }
    return ret;
@@ -433,16 +415,6 @@
  }
  /**
   * Handle KeyStore.
   *
   * @return The keyStore manager to be used for the command.
   */
  public KeyManager getKeyManager()
  {
    return secureArgsList.getKeyManager() ;
  }
  /**
   * Returns the timeout to be used to connect in milliseconds.  The method
   * must be called after parsing the arguments.
   * @return the timeout to be used to connect in milliseconds.  Returns
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java
@@ -55,6 +55,7 @@
import javax.security.sasl.SaslClient;
import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.ReturnCode;
import org.forgerock.i18n.LocalizableMessage;
@@ -69,7 +70,6 @@
import org.opends.server.types.LDAPException;
import org.opends.server.types.Control;
import org.opends.server.util.Base64;
import org.opends.server.util.PasswordReader;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
@@ -3582,7 +3582,14 @@
          if (gssapiAuthPW == null)
          {
            System.out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(gssapiAuthID));
            gssapiAuthPW = PasswordReader.readPassword();
            try
            {
              gssapiAuthPW = ConsoleApplication.readPassword();
            }
            catch (ClientException e)
            {
              throw new UnsupportedCallbackException(cb, e.getLocalizedMessage());
            }
          }
          ((PasswordCallback) cb).setPassword(gssapiAuthPW);
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPCompare.java
@@ -50,12 +50,12 @@
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.util.Base64;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.PasswordReader;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.CommonArguments;
import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.StringArgument;
@@ -812,7 +812,7 @@
      try
      {
        out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDNValue));
        char[] pwChars = PasswordReader.readPassword();
        char[] pwChars = ConsoleApplication.readPassword();
        bindPasswordValue = new String(pwChars);
        //As per rfc 4513(section-5.1.2) a client should avoid sending
        //an empty password to the server.
@@ -822,7 +822,7 @@
                  INFO_LDAPAUTH_NON_EMPTY_PASSWORD.get(),
                  MAX_LINE_WIDTH));
          out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDNValue));
          pwChars = PasswordReader.readPassword();
          pwChars = ConsoleApplication.readPassword();
        }
        bindPasswordValue = new String(pwChars);
      } catch(Exception ex)
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPDelete.java
@@ -47,12 +47,12 @@
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.PasswordReader;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.CommonArguments;
import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.StringArgument;
@@ -625,7 +625,7 @@
      try
      {
        out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDNValue));
        char[] pwChars = PasswordReader.readPassword();
        char[] pwChars = ConsoleApplication.readPassword();
        bindPasswordValue = new String(pwChars);
        //As per rfc 4513(section-5.1.2) a client should avoid sending
        //an empty password to the server.
@@ -635,7 +635,7 @@
                  INFO_LDAPAUTH_NON_EMPTY_PASSWORD.get(),
                  MAX_LINE_WIDTH));
          out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDNValue));
          pwChars = PasswordReader.readPassword();
          pwChars = ConsoleApplication.readPassword();
        }
        bindPasswordValue = new String(pwChars);
      } catch(Exception ex)
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPModify.java
@@ -67,12 +67,12 @@
import org.opends.server.util.LDIFReader;
import org.opends.server.util.ModifyChangeRecordEntry;
import org.opends.server.util.ModifyDNChangeRecordEntry;
import org.opends.server.util.PasswordReader;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.CommonArguments;
import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.StringArgument;
@@ -953,7 +953,7 @@
      try
      {
        out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDNValue));
        char[] pwChars = PasswordReader.readPassword();
        char[] pwChars = ConsoleApplication.readPassword();
        bindPasswordValue = new String(pwChars);
        //As per rfc 4513(section-5.1.2) a client should avoid sending
        //an empty password to the server.
@@ -963,7 +963,7 @@
                  INFO_LDAPAUTH_NON_EMPTY_PASSWORD.get(),
                  MAX_LINE_WIDTH));
          out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDNValue));
          pwChars = PasswordReader.readPassword();
          pwChars = ConsoleApplication.readPassword();
        }
        bindPasswordValue = new String(pwChars);
      } catch(Exception ex)
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPPasswordModify.java
@@ -48,12 +48,12 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.PasswordReader;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.CommonArguments;
import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.StringArgument;
@@ -647,7 +647,7 @@
        try
        {
          out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(dn));
          char[] pwChars = PasswordReader.readPassword();
          char[] pwChars = ConsoleApplication.readPassword();
          //As per rfc 4513(section-5.1.2) a client should avoid sending
          //an empty password to the server.
          while(pwChars.length==0)
@@ -656,7 +656,7 @@
                INFO_LDAPAUTH_NON_EMPTY_PASSWORD.get(),
                MAX_LINE_WIDTH));
            out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(dn));
            pwChars = PasswordReader.readPassword();
            pwChars = ConsoleApplication.readPassword();
          }
          pw = new String(pwChars);
        } catch(Exception ex)
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/tools/LDAPSearch.java
@@ -44,12 +44,12 @@
import org.opends.server.types.*;
import org.opends.server.util.Base64;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.PasswordReader;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.CommonArguments;
import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.MultiChoiceArgument;
@@ -1208,7 +1208,7 @@
      try
      {
        out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDNValue));
        char[] pwChars = PasswordReader.readPassword();
        char[] pwChars = ConsoleApplication.readPassword();
        bindPasswordValue = new String(pwChars);
        //As per rfc 4513(section-5.1.2) a client should avoid sending
        //an empty password to the server.
@@ -1218,7 +1218,7 @@
                  INFO_LDAPAUTH_NON_EMPTY_PASSWORD.get(),
                  MAX_LINE_WIDTH));
          out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDNValue));
          pwChars = PasswordReader.readPassword();
          pwChars = ConsoleApplication.readPassword();
        }
        bindPasswordValue = new String(pwChars);
      } catch(Exception ex)
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/util/PasswordReader.java
File was deleted
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/util/args/LDAPConnectionArgumentParser.java
@@ -28,14 +28,18 @@
package org.opends.server.util.args;
import org.forgerock.i18n.LocalizableMessage;
import static org.opends.messages.ToolMessages.*;
import org.opends.server.tools.LDAPConnection;
import org.opends.server.tools.LDAPConnectionOptions;
import org.opends.server.tools.SSLConnectionFactory;
import org.opends.server.tools.SSLConnectionException;
import org.opends.server.tools.LDAPConnectionException;
import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH;
import static org.opends.server.util.StaticUtils.wrapText;
import org.opends.server.util.cli.LDAPConnectionConsoleInteraction;
import org.opends.server.admin.client.cli.SecureConnectionCliArgs;
import org.opends.server.types.OpenDsException;
@@ -44,6 +48,7 @@
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.ArgumentGroup;
import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.StringArgument;
@@ -51,12 +56,12 @@
import java.util.LinkedHashSet;
import java.util.concurrent.atomic.AtomicInteger;
import java.io.PrintStream;
import javax.net.ssl.SSLException;
import org.opends.server.util.PasswordReader;
/**
 * Creates an argument parser pre-populated with arguments for specifying
 * information for openning and LDAPConnection an LDAP connection.
 * information for opening and LDAPConnection an LDAP connection.
 */
public class LDAPConnectionArgumentParser extends ArgumentParser {
@@ -498,7 +503,7 @@
      try
      {
        out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDN));
        char[] pwChars = PasswordReader.readPassword();
        char[] pwChars = ConsoleApplication.readPassword();
        pwd = new String(pwChars);
        //As per rfc 4513(section-5.1.2) a client should avoid sending
        //an empty password to the server.
@@ -508,7 +513,7 @@
                  INFO_LDAPAUTH_NON_EMPTY_PASSWORD.get(),
                  MAX_LINE_WIDTH));
          out.print(INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDN));
          pwChars = PasswordReader.readPassword();
          pwChars = ConsoleApplication.readPassword();
        }
        pwd = new String(pwChars);
      } catch(Exception ex)