changeset 31039:bc0bccdbc28f

jabber: Handle a corner case better by throwing an error instead of stalling This happens if the server *has* a TXT record for _xmppconnect.$domain, but has no useful content there. Fixes #12744, #a14367.
author Paul Aurich <paul@darkrain42.org>
date Thu, 14 Oct 2010 03:12:01 +0000
parents db41f73ac3b6
children 10aa18ac6774 ec8094410550
files ChangeLog libpurple/protocols/jabber/jabber.c
diffstat 2 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Oct 13 21:20:57 2010 +0000
+++ b/ChangeLog	Thu Oct 14 03:12:01 2010 +0000
@@ -60,6 +60,9 @@
 	  for Your Domain). (#a14153)
 	* Improved handling of adding oneself to your buddy list when using
 	  Non-SASL (legacy) authentication. (#12499)
+	* Generate a connection error instead of just stalling when the
+	  _xmppconnect TXT record returns results, but none of them result
+	  in a valid BOSH URI. (#a14367, #12744)
 
 	Yahoo/Yahoo JAPAN:
 	* Stop doing unnecessary lookups of certain alias information.  This
--- a/libpurple/protocols/jabber/jabber.c	Wed Oct 13 21:20:57 2010 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Thu Oct 14 03:12:01 2010 +0000
@@ -762,18 +762,10 @@
 txt_resolved_cb(GList *responses, gpointer data)
 {
 	JabberStream *js = data;
+	gboolean found = FALSE;
 
 	js->srv_query_data = NULL;
 
-	if (responses == NULL) {
-		purple_debug_warning("jabber", "Unable to find alternative XMPP connection "
-				  "methods after failing to connect directly.\n");
-		purple_connection_error_reason(js->gc,
-				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-				_("Unable to connect"));
-		return;
-	}
-
 	while (responses) {
 		PurpleTxtResponse *resp = responses->data;
 		gchar **token;
@@ -790,9 +782,17 @@
 	}
 
 	if (js->bosh) {
+		found = TRUE;
 		jabber_bosh_connection_connect(js->bosh);
-	} else {
-		purple_debug_info("jabber","Didn't find an alternative connection method.\n");
+	}
+
+	if (!found) {
+		purple_debug_warning("jabber", "Unable to find alternative XMPP connection "
+				  "methods after failing to connect directly.\n");
+		purple_connection_error_reason(js->gc,
+				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+				_("Unable to connect"));
+		return;
 	}
 
 	if (responses) {