You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2007/04/27 14:48:52 UTC

svn commit: r533083 - in /incubator/qpid/trunk/qpid: ./ java/broker/bin/ java/broker/src/main/java/org/apache/qpid/server/security/auth/database/ java/client/src/test/java/org/apache/qpid/client/ java/common/bin/

Author: ritchiem
Date: Fri Apr 27 05:48:51 2007
New Revision: 533083

URL: http://svn.apache.org/viewvc?view=rev&rev=533083
Log:
Merged revisions 533075-533079 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2

........
  r533075 | ritchiem | 2007-04-27 13:27:19 +0100 (Fri, 27 Apr 2007) | 2 lines
  
  QPID-473 Base64MD5PrincipalDatabase doesn't check password changes were applied to disk before storing in memory
  Reversed the effects of the requested change if the changes cannot be persisted to disk
........
  r533077 | ritchiem | 2007-04-27 13:29:52 +0100 (Fri, 27 Apr 2007) | 3 lines
  
  Bin Updates: Qpid-Run removed new bash 3.x feature += replaced with option="${value1} ${value2}" constructs to support older bash 2.x
  renamed passwd qpid-passwd and fixed classpath loading errors.
  Moved bdbbackup script to live with the bdb module.
........
  r533078 | ritchiem | 2007-04-27 13:30:07 +0100 (Fri, 27 Apr 2007) | 1 line
  
  Updated PrincipalDatabase implementations to return empty strings rather than null. As this causes NPE on MC.
........
  r533079 | ritchiem | 2007-04-27 13:31:03 +0100 (Fri, 27 Apr 2007) | 1 line
  
  Updated MLT to have variables that define the BROKER and VHOST used and White space
........

Added:
    incubator/qpid/trunk/qpid/java/broker/bin/qpid-passwd
      - copied unchanged from r533079, incubator/qpid/branches/M2/java/broker/bin/qpid-passwd
Removed:
    incubator/qpid/trunk/qpid/java/broker/bin/bdbbackup
    incubator/qpid/trunk/qpid/java/broker/bin/passwd
Modified:
    incubator/qpid/trunk/qpid/   (props changed)
    incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java
    incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java
    incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java
    incubator/qpid/trunk/qpid/java/common/bin/qpid-run

Propchange: incubator/qpid/trunk/qpid/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java?view=diff&rev=533083&r1=533082&r2=533083
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java Fri Apr 27 05:48:51 2007
@@ -182,6 +182,7 @@
             try
             {
                 _userUpdate.lock();
+                char[] orig = user.getPassword();
                 user.setPassword(password);
 
                 try
@@ -192,6 +193,8 @@
                 {
                     _logger.error("Unable to save password file, password change for user'"
                                   + principal + "' will revert at restart");
+                    //revert the password change
+                    user.setPassword(orig);
                     return false;
                 }
                 return true;
@@ -210,22 +213,6 @@
         }
     }
 
-    private char[] convertPassword(String password) throws UnsupportedEncodingException
-    {
-        byte[] passwdBytes = password.getBytes(DEFAULT_ENCODING);
-
-        char[] passwd = new char[passwdBytes.length];
-
-        int index = 0;
-
-        for (byte b : passwdBytes)
-        {
-            passwd[index++] = (char) b;
-        }
-
-        return passwd;
-    }
-
     public boolean createPrincipal(Principal principal, char[] password)
     {
         if (_users.get(principal.getName()) != null)
@@ -247,9 +234,10 @@
             }
             catch (IOException e)
             {
+                //remove the use on failure.
+                _users.remove(user.getName());
                 return false;
             }
-
         }
         finally
         {

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java?view=diff&rev=533083&r1=533082&r2=533083
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabase.java Fri Apr 27 05:48:51 2007
@@ -39,6 +39,7 @@
 import java.util.Map;
 import java.util.HashMap;
 import java.util.List;
+import java.util.LinkedList;
 import java.security.Principal;
 
 /**
@@ -157,7 +158,7 @@
 
     public List<Principal> getUsers()
     {
-        return null; //todo
+        return new LinkedList<Principal>(); //todo
     }
 
     public Principal getUser(String username)

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java?view=diff&rev=533083&r1=533082&r2=533083
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/PropertiesPrincipalDatabase.java Fri Apr 27 05:48:51 2007
@@ -31,6 +31,7 @@
 import java.util.Map;
 import java.util.HashMap;
 import java.util.List;
+import java.util.LinkedList;
 import java.security.Principal;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -142,7 +143,7 @@
 
     public List<Principal> getUsers()
     {
-        return null; //todo
+        return new LinkedList<Principal>(); //todo
     }
 
     public Principal getUser(String username)

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java?view=diff&rev=533083&r1=533082&r2=533083
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java Fri Apr 27 05:48:51 2007
@@ -63,17 +63,21 @@
     private MessageConsumer _consumer;
     private Connection _clientConnection;
     private CountDownLatch _awaitMessages = new CountDownLatch(MSG_COUNT);
+    private static final String BROKER = "vm://:1";
+    private static final String VHOST = "test";
 
     protected void setUp() throws Exception
     {
         super.setUp();
-        TransportConnection.createVMBroker(1);
-
+        if (BROKER.contains("vm://"))
+        {
+            TransportConnection.createVMBroker(1);
+        }
         InitialContextFactory factory = new PropertiesFileInitialContextFactory();
 
         Hashtable<String, String> env = new Hashtable<String, String>();
 
-        env.put("connectionfactory.connection", "amqp://guest:guest@MLT_ID/test?brokerlist='vm://:1'");
+        env.put("connectionfactory.connection", "amqp://guest:guest@MLT_ID/" + VHOST + "?brokerlist='" + BROKER + "'");
         env.put("queue.queue", "MessageListenerTest");
 
         _context = factory.getInitialContext(env);
@@ -113,7 +117,10 @@
         _clientConnection.close();
 
         super.tearDown();
-        TransportConnection.killAllVMBrokers();
+        if (BROKER.contains("vm://"))
+        {
+            TransportConnection.killAllVMBrokers();
+        }
     }
 
 
@@ -145,34 +152,34 @@
     }
 
     public void testRecieveTheUseMessageListener() throws Exception
-     {
+    {
 
-         _logger.error("Test disabled as initial receive is not called first");
-         // Perform initial receive to start connection
+        _logger.error("Test disabled as initial receive is not called first");
+        // Perform initial receive to start connection
 //         assertTrue(_consumer.receive(2000) != null);
 //         receivedCount++;
 
-         // Sleep to ensure remaining 4 msgs end up on _synchronousQueue
+        // Sleep to ensure remaining 4 msgs end up on _synchronousQueue
 //         Thread.sleep(1000);
 
-         // Set the message listener and wait for the messages to come in.
-         _consumer.setMessageListener(this);
+        // Set the message listener and wait for the messages to come in.
+        _consumer.setMessageListener(this);
 
-         _logger.info("Waiting 3 seconds for messages");
+        _logger.info("Waiting 3 seconds for messages");
+
+        try
+        {
+            _awaitMessages.await(3000, TimeUnit.MILLISECONDS);
+        }
+        catch (InterruptedException e)
+        {
+            //do nothing
+        }
+        //Should have recieved all async messages
+        assertEquals(MSG_COUNT, receivedCount);
 
-         try
-         {
-             _awaitMessages.await(3000, TimeUnit.MILLISECONDS);
-         }
-         catch (InterruptedException e)
-         {
-             //do nothing
-         }
-         //Should have recieved all async messages
-         assertEquals(MSG_COUNT, receivedCount);
+    }
 
-     }
-    
 
     public void onMessage(Message message)
     {

Modified: incubator/qpid/trunk/qpid/java/common/bin/qpid-run
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/bin/qpid-run?view=diff&rev=533083&r1=533082&r2=533083
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/bin/qpid-run (original)
+++ incubator/qpid/trunk/qpid/java/common/bin/qpid-run Fri Apr 27 05:48:51 2007
@@ -70,7 +70,7 @@
         echo Using qpid logprefix property
         LOG_PREFIX=" -Dlogprefix=$QPID_LOG_PREFIX"
     fi
-    SYSTEM_PROPS+=$LOG_PREFIX
+    SYSTEM_PROPS="${SYSTEM_PROPS} ${LOG_PREFIX}"
 fi
 
 if [ -n "$QPID_LOG_SUFFIX" ]; then
@@ -81,7 +81,7 @@
         echo Using qpig logsuffix property
         LOG_SUFFIX=" -Dlogsuffix=$QPID_LOG_SUFFIX"
     fi
-    SYSTEM_PROPS+=$LOG_SUFFIX
+    SYSTEM_PROPS="${SYSTEM_PROPS} ${LOG_SUFFIX}"
 fi
 
 echo System Properties set to $SYSTEM_PROPS
@@ -146,7 +146,7 @@
   if [ -z "$PREVIOUS_ARGS" ]; then
     PREVIOUS_ARGS=$1
   else
-    PREVIOUS_ARGS+=", $1"
+    PREVIOUS_ARGS="${PREVIOUS_ARGS}, $1"
     DISPATCH() {
       die -usage "you must choose one of: $PREVIOUS_ARGS"
     }
@@ -168,7 +168,7 @@
       if [ -z "$JPDA_OPTS" ]; then
         JPDA_OPTS="-Xdebug -Xrunjdwp:transport=${JPDA_TRANSPORT:-dt_socket},address=${JPDA_ADDRESS:-8000},server=y,suspend=n"
       fi
-      QPID_OPTS+=" ${JPDA_OPTS}"
+      QPID_OPTS="${QPID_OPTS} ${JPDA_OPTS}"
       ;;
     -run:external-classpath=*)
 #USAGE: controls how the CLASSPATH environment variable is used by