You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/12/22 00:40:06 UTC

[1/3] activemq-artemis git commit: ARTEMIS-901 Account for the presence of authzid in sasl plan auth

Repository: activemq-artemis
Updated Branches:
  refs/heads/master d61ca69b6 -> a3490cad2


ARTEMIS-901 Account for the presence of authzid in sasl plan auth

If the SASL plain mechanism arrives with the authzid value set the
mechanism needs to account for its presence and use the correct fields
of the exchange to get the username and password values.  Adds some
tests to validate this fix.  

Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/51c95bab
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/51c95bab
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/51c95bab

Branch: refs/heads/master
Commit: 51c95babfeb8245b8d87d3cbbdfa73ae0bdf04e0
Parents: d61ca69
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Dec 21 18:18:54 2016 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Dec 21 18:18:54 2016 -0500

----------------------------------------------------------------------
 .../protocol/amqp/sasl/ServerSASLPlain.java     | 25 ++++----
 .../transport/amqp/client/AmqpConnection.java   | 30 ++++++----
 .../integration/amqp/AmqpSecurityTest.java      | 61 ++++++++++++++++++--
 3 files changed, 87 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/51c95bab/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/ServerSASLPlain.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/ServerSASLPlain.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/ServerSASLPlain.java
index da26d2e..177334c 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/ServerSASLPlain.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/ServerSASLPlain.java
@@ -27,23 +27,22 @@ public class ServerSASLPlain implements ServerSASL {
 
    @Override
    public SASLResult processSASL(byte[] data) {
-
       String username = null;
       String password = null;
       String bytes = new String(data);
       String[] credentials = bytes.split(Character.toString((char) 0));
-      int offSet = 0;
-      if (credentials.length > 0) {
-         if (credentials[0].length() == 0) {
-            offSet = 1;
-         }
-
-         if (credentials.length >= offSet) {
-            username = credentials[offSet];
-         }
-         if (credentials.length >= (offSet + 1)) {
-            password = credentials[offSet + 1];
-         }
+
+      switch (credentials.length) {
+         case 2:
+            username = credentials[0];
+            password = credentials[1];
+            break;
+         case 3:
+            username = credentials[1];
+            password = credentials[2];
+            break;
+         default:
+            break;
       }
 
       boolean success = authenticate(username, password);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/51c95bab/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
----------------------------------------------------------------------
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
index 723daef..fa44c02 100644
--- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.transport.amqp.client;
 
+import static org.apache.activemq.transport.amqp.AmqpSupport.CONNECTION_OPEN_FAILED;
+
 import java.io.IOException;
 import java.net.URI;
 import java.nio.ByteBuffer;
@@ -30,9 +32,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
 
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import io.netty.util.ReferenceCountUtil;
 import org.apache.activemq.transport.InactivityIOException;
 import org.apache.activemq.transport.amqp.client.sasl.SaslAuthenticator;
 import org.apache.activemq.transport.amqp.client.transport.NettyTransportListener;
@@ -54,7 +53,9 @@ import org.apache.qpid.proton.engine.impl.TransportImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.activemq.transport.amqp.AmqpSupport.CONNECTION_OPEN_FAILED;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.util.ReferenceCountUtil;
 
 public class AmqpConnection extends AmqpAbstractResource<Connection> implements NettyTransportListener {
 
@@ -169,13 +170,22 @@ public class AmqpConnection extends AmqpAbstractResource<Connection> implements
             }
          });
 
-         if (connectTimeout <= 0) {
-            future.sync();
-         } else {
-            future.sync(connectTimeout, TimeUnit.MILLISECONDS);
-            if (getEndpoint().getRemoteState() != EndpointState.ACTIVE) {
-               throw new IOException("Failed to connect after configured timeout.");
+         try {
+            if (connectTimeout <= 0) {
+               future.sync();
+            } else {
+               future.sync(connectTimeout, TimeUnit.MILLISECONDS);
+               if (getEndpoint().getRemoteState() != EndpointState.ACTIVE) {
+                  throw new IOException("Failed to connect after configured timeout.");
+               }
             }
+         } catch (Throwable e) {
+            try {
+               close();
+            } catch (Throwable ignore) {
+            }
+
+            throw e;
          }
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/51c95bab/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSecurityTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSecurityTest.java
index 2c15c35..07b2ddc 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSecurityTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSecurityTest.java
@@ -16,6 +16,12 @@
  */
 package org.apache.activemq.artemis.tests.integration.amqp;
 
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.security.Role;
@@ -33,12 +39,6 @@ import org.apache.activemq.transport.amqp.client.AmqpValidator;
 import org.apache.qpid.proton.engine.Delivery;
 import org.junit.Test;
 
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
 public class AmqpSecurityTest extends AmqpClientTestSupport {
 
    @Override
@@ -62,6 +62,55 @@ public class AmqpSecurityTest extends AmqpClientTestSupport {
    }
 
    @Test(timeout = 60000)
+   public void testSaslAuthWithInvalidCredentials() throws Exception {
+      AmqpConnection connection = null;
+      AmqpClient client = createAmqpClient("foo", "foo");
+
+      try {
+         connection = client.connect();
+         fail("Should authenticate even with authzid set");
+      } catch (Exception ex) {
+      } finally {
+         if (connection != null) {
+            connection.close();
+         }
+      }
+   }
+
+   @Test(timeout = 60000)
+   public void testSaslAuthWithAuthzid() throws Exception {
+      AmqpConnection connection = null;
+      AmqpClient client = createAmqpClient("foo", "bar");
+      client.setAuthzid("foo");
+
+      try {
+         connection = client.connect();
+      } catch (Exception ex) {
+         fail("Should authenticate even with authzid set");
+      } finally {
+         if (connection != null) {
+            connection.close();
+         }
+      }
+   }
+
+   @Test(timeout = 60000)
+   public void testSaslAuthWithoutAuthzid() throws Exception {
+      AmqpConnection connection = null;
+      AmqpClient client = createAmqpClient("foo", "bar");
+
+      try {
+         connection = client.connect();
+      } catch (Exception ex) {
+         fail("Should authenticate even with authzid set");
+      } finally {
+         if (connection != null) {
+            connection.close();
+         }
+      }
+   }
+
+   @Test(timeout = 60000)
    public void testSendAndRejected() throws Exception {
       AmqpConnection connection = null;
       AmqpClient client = createAmqpClient("foo", "bar");


[2/3] activemq-artemis git commit: This closes #940

Posted by cl...@apache.org.
This closes #940


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2ddf5d63
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2ddf5d63
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2ddf5d63

Branch: refs/heads/master
Commit: 2ddf5d63cbcaff97aeb54461c050cfde22f0ca49
Parents: d61ca69 51c95ba
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Dec 21 19:34:45 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Dec 21 19:34:45 2016 -0500

----------------------------------------------------------------------
 .../protocol/amqp/sasl/ServerSASLPlain.java     | 25 ++++----
 .../transport/amqp/client/AmqpConnection.java   | 30 ++++++----
 .../integration/amqp/AmqpSecurityTest.java      | 61 ++++++++++++++++++--
 3 files changed, 87 insertions(+), 29 deletions(-)
----------------------------------------------------------------------



[3/3] activemq-artemis git commit: ARTEMIS-896 removing 32 bit lib

Posted by cl...@apache.org.
ARTEMIS-896 removing 32 bit lib


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a3490cad
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a3490cad
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a3490cad

Branch: refs/heads/master
Commit: a3490cad22355635e053931342cd493630e4ea5e
Parents: 2ddf5d6
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Dec 21 19:39:54 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Dec 21 19:39:54 2016 -0500

----------------------------------------------------------------------
 artemis-native/pom.xml | 18 ------------------
 1 file changed, 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a3490cad/artemis-native/pom.xml
----------------------------------------------------------------------
diff --git a/artemis-native/pom.xml b/artemis-native/pom.xml
index 7e32109..29bd482 100644
--- a/artemis-native/pom.xml
+++ b/artemis-native/pom.xml
@@ -63,24 +63,6 @@
             <artifactId>maven-resources-plugin</artifactId>
             <executions>
                <execution>
-                  <id>copy-resources-32</id>
-                  <phase>validate</phase>
-                  <goals>
-                     <goal>copy-resources</goal>
-                  </goals>
-                  <configuration>
-                     <outputDirectory>${basedir}/target/output/lib/linux-i686/</outputDirectory>
-                     <resources>
-                        <resource>
-                           <directory>bin/</directory>
-                           <includes>
-                              <include>libartemis-native-32.so</include>
-                           </includes>
-                        </resource>
-                     </resources>
-                  </configuration>
-               </execution>
-               <execution>
                   <id>copy-resources-64</id>
                   <phase>validate</phase>
                   <goals>