libpurple/protocols/jabber/auth.c

branch
cpw.malu.client_type
changeset 27289
32591a46eb78
parent 27170
447ef31d038a
child 27232
a9a3e03b1399
--- a/libpurple/protocols/jabber/auth.c	Sun May 17 19:04:15 2009 +0000
+++ b/libpurple/protocols/jabber/auth.c	Mon May 25 19:24:17 2009 +0000
@@ -689,6 +689,18 @@
 	JabberIq *iq;
 	xmlnode *query, *username;
 
+	/* 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.
+	 */
+	if (!jabber_stream_is_ssl(js) &&
+			purple_account_get_bool(purple_connection_get_account(js->gc), "require_tls", FALSE)) {
+		purple_connection_error_reason (js->gc,
+			PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
+			_("You require encryption, but it is not available on this server."));
+		return;
+	}
+
 #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

mercurial