Include channel bindings if present and the server supports
[cyrus-sasl.git] / lib / client.c
index d4b37f0..0783906 100644 (file)
@@ -618,8 +618,11 @@ int sasl_client_start(sasl_conn_t *conn,
                break;
            }
 
-           /* Prefer server advertised CB mechanisms */
-           if (SASL_CB_PRESENT(c_conn->cparams) && plus) {
+            /*
+             * Include channel bindings if present and the server supports
+             * them or we are not negotiating mechanisms.
+             */
+           if (SASL_CB_PRESENT(c_conn->cparams) && (plus || list_len == 1)) {
                cbindingdisp = SASL_CB_DISP_USED;
            }