qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject qpid-proton git commit: PROTON-978: Fix server "pipelined" SASL frame read processing - Previously we were erroneously trying to process the AMQP header as a SASL frame.
Date Tue, 11 Aug 2015 18:58:27 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/0.10.x e87f61719 -> 3103ea743


PROTON-978: Fix server "pipelined" SASL frame read processing
- Previously we were erroneously trying to process the AMQP header
  as a SASL frame.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/3103ea74
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/3103ea74
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/3103ea74

Branch: refs/heads/0.10.x
Commit: 3103ea7435bb5fce5b58176ebd362169351c16a8
Parents: e87f617
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Tue Aug 11 14:53:55 2015 -0400
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Tue Aug 11 14:55:30 2015 -0400

----------------------------------------------------------------------
 proton-c/src/sasl/sasl.c          | 15 +++++----------
 tests/python/proton_tests/sasl.py |  7 +------
 2 files changed, 6 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3103ea74/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index f300f91..6e1ce1d 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -313,14 +313,8 @@ static ssize_t pn_input_read_sasl(pn_transport_t* transport, unsigned
int layer,
 
   pni_sasl_start_server_if_needed(transport);
 
-  ssize_t n = pn_dispatcher_input(transport, bytes, available, false, &transport->halt);
-
   if (!pni_sasl_is_final_input_state(sasl)) {
-    return n;
-  }
-
-  if (!sasl->client && n!=0) {
-    return n;
+    return pn_dispatcher_input(transport, bytes, available, false, &transport->halt);
   }
 
   if (pni_sasl_impl_can_encrypt(transport)) {
@@ -331,10 +325,9 @@ static ssize_t pn_input_read_sasl(pn_transport_t* transport, unsigned
int layer,
   } else if (sasl->client) {
     transport->io_layers[layer] = &pni_passthru_layer;
   } else {
-    assert(n==0);
-    return pni_passthru_layer.process_input(transport, layer, bytes, available );
+    return pni_passthru_layer.process_input(transport, layer, bytes, available);
   }
-  return n+transport->io_layers[layer]->process_input(transport, layer, bytes+n, available-n);
+  return transport->io_layers[layer]->process_input(transport, layer, bytes, available);
 }
 
 static ssize_t pn_input_read_sasl_encrypt(pn_transport_t* transport, unsigned int layer,
const char* bytes, size_t available)
@@ -393,10 +386,12 @@ static ssize_t pn_output_write_sasl(pn_transport_t* transport, unsigned
int laye
     return pn_dispatcher_output(transport, bytes, available);
   }
 
+  // We only get here if there is nothing to output and we're a final output state
   if (sasl->outcome != PN_SASL_OK && pni_sasl_is_final_input_state(sasl)) {
     return PN_EOS;
   }
 
+  // We know that auth succeeded or we're not in final input state
   if (pni_sasl_impl_can_encrypt(transport)) {
     sasl->max_encrypt_size = pni_sasl_impl_max_encrypt_size(transport);
     if (transport->trace & PN_TRACE_DRV)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3103ea74/tests/python/proton_tests/sasl.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/sasl.py b/tests/python/proton_tests/sasl.py
index 72fa76c..24ff195 100644
--- a/tests/python/proton_tests/sasl.py
+++ b/tests/python/proton_tests/sasl.py
@@ -79,6 +79,7 @@ class SaslTest(Test):
     self.t1 = Transport()
     self.s1 = SASL(self.t1)
     self.t2 = Transport(Transport.SERVER)
+    self.t2.max_frame_size = 65536
     self.s2 = SASL(self.t2)
 
   def pump(self):
@@ -151,12 +152,6 @@ class SaslTest(Test):
     self.s1.allowed_mechs('ANONYMOUS')
     self.s2.allowed_mechs('ANONYMOUS')
 
-    # send the server's OK to the client
-    # This is still needed for the Java impl
-    out2 = self.t2.peek(1024)
-    self.t2.pop(len(out2))
-    self.t1.push(out2)
-
     # do some work to generate AMQP data
     c1 = Connection()
     c2 = Connection()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message