Use SASL before old style auth if both are supported. [#19]
authorJelmer Vernooij <jelmer@samba.org>
Mon, 06 Oct 2008 11:28:45 +0200
changeset 510 3f6ec5ce4b1d
parent 509 497afdad39a5
child 512 9f050099129d
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	Mon Oct 06 02:17:36 2008 +0200
+++ b/loudmouth/lm-connection.c	Mon Oct 06 11:28:45 2008 +0200
@@ -1126,6 +1126,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_old_socket_get_use_starttls (connection->socket)) {
@@ -1197,7 +1198,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