[jboss-cvs] JBossAS SVN: r112479 - branches/JBPAPP_5_1/server/src/main/org/jboss.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 28 09:16:26 EST 2011
Author: dcheung
Date: 2011-11-28 09:16:26 -0500 (Mon, 28 Nov 2011)
New Revision: 112479
Modified:
branches/JBPAPP_5_1/server/src/main/org/jboss/Shutdown.java
Log:
This commit attempts to fix JBPAPP-6628 - Password not masked in the shutdown script
Modified: branches/JBPAPP_5_1/server/src/main/org/jboss/Shutdown.java
===================================================================
--- branches/JBPAPP_5_1/server/src/main/org/jboss/Shutdown.java 2011-11-28 14:13:22 UTC (rev 112478)
+++ branches/JBPAPP_5_1/server/src/main/org/jboss/Shutdown.java 2011-11-28 14:16:26 UTC (rev 112479)
@@ -46,6 +46,7 @@
import org.jboss.security.SimplePrincipal;
import org.jnp.interfaces.NamingContext;
+import java.io.Console;
/**
* A JMX client that uses an MBeanServerConnection to shutdown a remote JBoss
* server.
@@ -195,9 +196,15 @@
// If there was a username specified, but no password prompt for it
if( username != null && password == null )
{
- System.out.print("Enter password for "+username+": ");
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- password = br.readLine();
+ Console c = System.console();
+ // If there is no console, use the previous way of retrieving the password
+ if (c == null) {
+ System.out.print("Enter password for "+username+": ");
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ password = br.readLine();
+ } else {
+ password = new String(c.readPassword("Enter password for "+username+": "));
+ }
SecurityAssociation.setCredential(password);
}
More information about the jboss-cvs-commits
mailing list