diff libpurple/protocols/jabber/parser.c @ 28694:c7aaad89a2f8

jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors. Legacy servers don't send <stream:features>, so we need to notice when we've finished the opening <stream:stream> tag and, if there was no version, start authentication right then. This was causingon other valid errors (like the server complaining it's not who we think it is) to be replaced by a complaint "You require encryption...". Closes #10450. This seems to work in all the cases I've tested (including with jabberd14).
author Paul Aurich <paul@darkrain42.org>
date Tue, 06 Oct 2009 03:25:26 +0000
parents c585572e80dd
children 61cd675b73df 8ada06fb65ed
line wrap: on
line diff
--- a/libpurple/protocols/jabber/parser.c	Mon Oct 05 18:10:08 2009 +0000
+++ b/libpurple/protocols/jabber/parser.c	Tue Oct 06 03:25:26 2009 +0000
@@ -62,11 +62,6 @@
 				g_free(attrib);
 			}
 		}
-		if(js->protocol_version == JABBER_PROTO_0_9)
-			js->auth_type = JABBER_AUTH_IQ_AUTH;
-
-		if(js->state == JABBER_STREAM_INITIALIZING || js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION)
-			jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING);
 	} else {
 
 		if(js->current)
@@ -256,5 +251,17 @@
 				break;
 		}
 	}
+
+	if (js->protocol_version == JABBER_PROTO_0_9 && !js->gc->disconnect_timeout &&
+			(js->state == JABBER_STREAM_INITIALIZING ||
+			 js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION)) {
+		/*
+		 * Legacy servers don't advertise features, so if we've just gotten
+		 * the opening <stream:stream> and there was no version, we need to
+		 * immediately start legacy IQ auth.
+		 */
+		js->auth_type = JABBER_AUTH_IQ_AUTH;
+		jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING);
+	}
 }