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

coulbeck
11.50.2007 a79011f624c210800f747f0d3bf549970b769b66
Fix for issue #1604: status command does not allow password from stdin.
2 files modified
22 ■■■■■ changed files
opends/src/statuspanel/org/opends/statuspanel/StatusCli.java 19 ●●●●● patch | view | raw | blame | history
opends/src/statuspanel/org/opends/statuspanel/resources/Resources.properties 3 ●●●● patch | view | raw | blame | history
opends/src/statuspanel/org/opends/statuspanel/StatusCli.java
@@ -50,6 +50,9 @@
import org.opends.statuspanel.ui.ListenersTableModel;
import static org.opends.server.tools.ToolConstants.*;
import org.opends.server.util.PasswordReader;
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.messages.MessageHandler.*;
/**
 * The class used to provide some CLI interface to display status.
@@ -167,7 +170,7 @@
        }
        else
        {
          if (args[i+1].indexOf("-") == 0)
          if (args[i+1].indexOf("-") == 0 && args[i+1].length() > 1)
          {
            errors.add(getMsg("cli-status-root-user-pwd-not-provided", true));
          }
@@ -213,6 +216,20 @@
    }
    else
    {
      if(directoryManagerPwd != null && directoryManagerPwd.equals("-"))
      {
        // read the password from stdin.
        try
        {
          System.out.print(getMsg("cli-status-ldapauth-password-prompt",
                                  new String[] {directoryManagerDn}, false));
          char[] pwChars = PasswordReader.readPassword();
          directoryManagerPwd = new String(pwChars);
        } catch(Exception ex)
        {
          errors.add(ex.getMessage());
        }
      }
      if (directoryManagerPwdFile != null)
      {
        directoryManagerPwd = readPwdFromFile(directoryManagerPwdFile);
opends/src/statuspanel/org/opends/statuspanel/resources/Resources.properties
@@ -170,7 +170,8 @@
time.
cli-status-error-reading-pwd-file=Could not read the password from \
file {0}.  Check that the file path is correct, that you have access rights to \
it and that it contains a password.
it and that it contains a password.
cli-status-ldapauth-password-prompt=Password for user {0}:
status-cli-usage=This utility may be used to display basic server \
information\n\n\
Usage:  {0} {options}\n        where {options} include:\n\