[jboss-cvs] JBoss Messaging SVN: r8081 - in branches/Branch_1_4: tests/src/org/jboss/test/messaging/jms/server and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Aug 24 10:52:20 EDT 2010
Author: gaohoward
Date: 2010-08-24 10:52:19 -0400 (Tue, 24 Aug 2010)
New Revision: 8081
Modified:
branches/Branch_1_4/src/main/org/jboss/jms/server/ServerPeer.java
branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java
Log:
JBMESSAGING-1816
Modified: branches/Branch_1_4/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/server/ServerPeer.java 2010-08-12 16:11:50 UTC (rev 8080)
+++ branches/Branch_1_4/src/main/org/jboss/jms/server/ServerPeer.java 2010-08-24 14:52:19 UTC (rev 8081)
@@ -27,6 +27,8 @@
import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.net.URL;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -39,6 +41,9 @@
import java.util.Set;
import java.util.StringTokenizer;
+import javax.crypto.BadPaddingException;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
import javax.management.Attribute;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanServer;
@@ -304,11 +309,6 @@
{
suckerPassword = SecurityMetadataStore.DEFAULT_SUCKER_USER_PASSWORD;
}
- else
- {
- //https://jira.jboss.org/jira/browse/JBMESSAGING-1806
- suckerPassword = new String(SecurityUtil.decode(suckerPassword));
- }
// Allow the securityStore to default to the SecurityMetadataStore impl
if (isDefaultSecurityStore)
{
@@ -783,7 +783,7 @@
this.defaultTopicJNDIContext = defaultTopicJNDIContext;
}
- public synchronized void setSuckerPassword(String password)
+ public synchronized void setSuckerPassword(String password) throws InvalidKeyException, NoSuchPaddingException, NoSuchAlgorithmException, BadPaddingException, IllegalBlockSizeException
{
if (started)
{
@@ -795,7 +795,8 @@
throw new IllegalArgumentException("SuckerPassword cannot be null");
}
- this.suckerPassword = password;
+ //https://jira.jboss.org/jira/browse/JBMESSAGING-1816
+ suckerPassword = new String(SecurityUtil.decode(password));
}
public void setStrictTck(boolean strictTck)
Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java 2010-08-12 16:11:50 UTC (rev 8080)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java 2010-08-24 14:52:19 UTC (rev 8081)
@@ -39,6 +39,7 @@
import javax.jms.XAConnectionFactory;
import javax.jms.XASession;
import javax.management.ObjectName;
+import javax.management.RuntimeMBeanException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameNotFoundException;
@@ -1013,7 +1014,62 @@
ServerManagement.undeployQueue("Queue");
}
}
+
+ //https://jira.jboss.org/browse/JBMESSAGING-1816
+ public void testServerPeerStartStopWithSuckerpassword() throws Exception {
+ if(!ServerManagement.isServerPeerStarted())
+ {
+ ServerManagement.startServerPeer();
+ }
+ ServerManagement.invoke(ServerManagement.getServerPeerObjectName(),
+ "stop", null, null);
+ ServerManagement.invoke(ServerManagement.getServerPeerObjectName(),
+ "start", null, null);
+ }
+
+ //https://jira.jboss.org/browse/JBMESSAGING-1816
+ public void testServerPeerStartStopWithSuckerpassword2() throws Exception {
+ if(!ServerManagement.isServerPeerStarted())
+ {
+ ServerManagement.startServerPeer();
+ }
+ ServerManagement.invoke(ServerManagement.getServerPeerObjectName(),
+ "stop", null, null);
+ try
+ {
+ ServerManagement.setAttribute(ServerManagement.getServerPeerObjectName(), "SuckerPassword", "CHANGE_ME!!");
+ fail("Sucker password shouldn't be clear text.");
+ }
+ catch (RuntimeMBeanException e)
+ {
+ Throwable root = e.getCause();
+ if (root instanceof NumberFormatException)
+ {
+ //correct, we got expected exception.
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ ServerManagement.invoke(ServerManagement.getServerPeerObjectName(),
+ "start", null, null);
+ }
+
+ //https://jira.jboss.org/browse/JBMESSAGING-1816
+ public void testServerPeerStartStopWithSuckerpassword3() throws Exception {
+ if(!ServerManagement.isServerPeerStarted())
+ {
+ ServerManagement.startServerPeer();
+ }
+ ServerManagement.invoke(ServerManagement.getServerPeerObjectName(),
+ "stop", null, null);
+ ServerManagement.setAttribute(ServerManagement.getServerPeerObjectName(), "SuckerPassword", "1de02ff5bdef46a62f102f743db8daf7");
+ ServerManagement.invoke(ServerManagement.getServerPeerObjectName(),
+ "start", null, null);
+ }
+
/**
* @param txList
* @return
More information about the jboss-cvs-commits
mailing list