changeset 28658:fa77b70c8ca6

jabber: Always require a resource when starting Legacy IQ Auth. It's possible to get to jabber_auth_start_old via SASL auth (when iChat Server says it will accept only GSSAPI). If the user has no resource specified, iChat Server will silently fail the authentication but pretend it succeeded.
author Paul Aurich <paul@darkrain42.org>
date Thu, 24 Sep 2009 16:38:49 +0000
parents c9d3bda6ef81
children c42d5c23a9e8
files ChangeLog libpurple/protocols/jabber/auth.c libpurple/protocols/jabber/jabber.c
diffstat 3 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Sep 24 01:50:02 2009 +0000
+++ b/ChangeLog	Thu Sep 24 16:38:49 2009 +0000
@@ -3,6 +3,8 @@
 version 2.6.3 (??/??/20??):
 	XMPP:
 	* Fix a crash when attempting to validate an invalid JID.
+	* Resolve an issue when connecting to iChat Server when no resource
+	  is specified.
 
 	General:
 	* New 'plugins' sub-command to 'debug' command (i.e. '/debug plugins')
--- a/libpurple/protocols/jabber/auth.c	Thu Sep 24 01:50:02 2009 +0000
+++ b/libpurple/protocols/jabber/auth.c	Thu Sep 24 16:38:49 2009 +0000
@@ -692,7 +692,8 @@
 	JabberIq *iq;
 	xmlnode *query, *username;
 
-	/* We can end up here without encryption if the server doesn't support
+	/*
+	 * We can end up here without encryption if the server doesn't support
 	 * <stream:features/> and we're not using old-style SSL.  If the user
 	 * is requiring SSL/TLS, we need to enforce it.
 	 */
@@ -704,6 +705,16 @@
 		return;
 	}
 
+	/*
+	 * IQ Auth doesn't have support for resource binding, so we need to pick a
+	 * default resource so it will work properly.  jabberd14 throws an error and
+	 * iChat server just fails silently.
+	 */
+	if (!js->user->resource || *js->user->resource == '\0') {
+		g_free(js->user->resource);
+		js->user->resource = g_strdup("Home");
+	}
+
 #ifdef HAVE_CYRUS_SASL
 	/* If we have Cyrus SASL, then passwords will have been set
 	 * to OPTIONAL for this protocol. So, we need to do our own
--- a/libpurple/protocols/jabber/jabber.c	Thu Sep 24 01:50:02 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Thu Sep 24 16:38:49 2009 +0000
@@ -1593,15 +1593,6 @@
 			if(js->protocol_version == JABBER_PROTO_0_9 && js->registration) {
 				jabber_register_start(js);
 			} else if(js->auth_type == JABBER_AUTH_IQ_AUTH) {
-				/* with dreamhost's xmpp server at least, you have to
-				   specify a resource or you will get a "406: Not
-				   Acceptable"
-				*/
-				if(!js->user->resource || *js->user->resource == '\0') {
-					g_free(js->user->resource);
-					js->user->resource = g_strdup("Home");
-				}
-
 				jabber_auth_start_old(js);
 			}
 			break;