From a79011f624c210800f747f0d3bf549970b769b66 Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Fri, 11 May 2007 16:50:12 +0000
Subject: [PATCH] Fix for issue #1604: status command does not allow password from stdin.
---
opends/src/statuspanel/org/opends/statuspanel/StatusCli.java | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/opends/src/statuspanel/org/opends/statuspanel/StatusCli.java b/opends/src/statuspanel/org/opends/statuspanel/StatusCli.java
index 9d01935..a34d80f 100644
--- a/opends/src/statuspanel/org/opends/statuspanel/StatusCli.java
+++ b/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);
--
Gitblit v1.10.0