You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2015/08/11 22:22:55 UTC

qpid-proton git commit: PROTON-974: Accept a single symbol in SASL mechs frame - As well as an array of symbols - This is a specific interop issue with qpidd AMQP 1.0 support

Repository: qpid-proton
Updated Branches:
  refs/heads/master cbba30d69 -> e47f671d7


PROTON-974: Accept a single symbol in SASL mechs frame
- As well as an array of symbols
- This is a specific interop issue with qpidd AMQP 1.0 support


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

Branch: refs/heads/master
Commit: e47f671d79f51ee4374b113f3360b0d05f51d30f
Parents: cbba30d
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Aug 11 16:21:39 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Aug 11 16:21:39 2015 -0400

----------------------------------------------------------------------
 proton-c/src/sasl/sasl.c | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e47f671d/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index 6e1ce1d..fb98894 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -671,24 +671,37 @@ int pn_do_mechanisms(pn_transport_t *transport, uint8_t frame_type, uint16_t cha
 
   // This scanning relies on pn_data_scan leaving the pn_data_t cursors
   // where they are after finishing the scan
-  int err = pn_data_scan(args, "D.[@[");
+  pn_string_t *mechs = pn_string("");
+
+  // Try array of symbols for mechanism list
+  bool array = false;
+  int err = pn_data_scan(args, "D.[?@[", &array);
   if (err) return err;
 
-  pn_string_t *mechs = pn_string("");
+  if (array) {
+    // Now keep checking for end of array and pull a symbol
+    while(pn_data_next(args)) {
+      pn_bytes_t s = pn_data_get_symbol(args);
+      if (pni_included_mech(transport->sasl->included_mechanisms, s)) {
+        pn_string_addf(mechs, "%*s ", (int)s.size, s.start);
+      }
+    }
 
-  // Now keep checking for end of array and pull a symbol
-  while(pn_data_next(args)) {
-    pn_bytes_t s = pn_data_get_symbol(args);
-    if (pni_included_mech(transport->sasl->included_mechanisms, s)) {
-      pn_string_addf(mechs, "%*s ", (int)s.size, s.start);
+    if (pn_string_size(mechs)) {
+        pn_string_buffer(mechs)[pn_string_size(mechs)-1] = 0;
     }
-  }
+  } else {
+    // No array of symbols; try single symbol
+    pn_data_rewind(args);
+    pn_bytes_t symbol;
+    int err = pn_data_scan(args, "D.[s]", &symbol);
+    if (err) return err;
 
-  if (pn_string_size(mechs)) {
-      pn_string_buffer(mechs)[pn_string_size(mechs)-1] = 0;
+    pn_string_setn(mechs, symbol.start, symbol.size);
   }
 
   if (pni_init_client(transport) &&
+      pn_string_size(mechs) &&
       pni_process_mechanisms(transport, pn_string_get(mechs))) {
     pni_sasl_set_desired_state(transport, SASL_POSTED_INIT);
   } else {


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