Use SASL before old style auth if both are supported. [#19]
authorJelmer Vernooij <jelmer@samba.org>
Mon, 06 Oct 2008 11:31:46 +0200
changeset 511 2eee98b870e7
parent 498 7b2f03410e76
child 514 31d914756fde
Use SASL before old style auth if both are supported. [#19] Fixes an issue when server provides both old style and SASL authentication mechanisms. Loudmouth currently only checked if old style auth were supported and assumed that SASL weren't in those cases. [#19 tagged:committed responsible:Hallski milestone:none state:resolved] committer: Mikael Hallendal <micke@imendio.com>
loudmouth/lm-connection.c
--- a/loudmouth/lm-connection.c	Thu Aug 28 17:24:28 2008 +0200
+++ b/loudmouth/lm-connection.c	Mon Oct 06 11:31:46 2008 +0200
@@ -1043,6 +1043,7 @@
 	LmMessageNode *bind_node;
 	LmMessageNode    *starttls_node;
 	LmMessageNode *old_auth;
+	LmMessageNode *sasl_mechanisms;
 	
 	starttls_node = lm_message_node_find_child (message->node, "starttls");
 	if (connection->ssl && lm_ssl_get_use_starttls (connection->ssl)) {
@@ -1114,7 +1115,9 @@
 	}
 
 	old_auth = lm_message_node_find_child (message->node, "auth");
-	if (connection->use_sasl && old_auth) {
+
+	sasl_mechanisms = lm_message_node_find_child (message->node, "mechanisms");
+	if (connection->use_sasl && old_auth != NULL && sasl_mechanisms == NULL) {
 		g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL, 
 		       "Server uses XEP-0078 (jabber iq auth) instead of SASL\n");
 		/* So the server is XMPP1.0, but doesn't support SASL and uses