changeset 15766:51dd9ae01585

pass the correct domain to cyrus sasl (sf patch 1663064)
author Nathan Walp <nwalp@pidgin.im>
date Sat, 03 Mar 2007 19:18:38 +0000
parents 20225df32b7e
children 2d739b7a14ac
files libpurple/protocols/jabber/auth.c libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.h
diffstat 3 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/auth.c	Mon Feb 26 09:41:38 2007 +0000
+++ b/libpurple/protocols/jabber/auth.c	Sat Mar 03 19:18:38 2007 +0000
@@ -207,13 +207,8 @@
 
 	do {
 		again = FALSE;
-		/* Use the user's domain for compatibility with the old
-		 * DIGESTMD5 code. Note that this may cause problems where
-		 * the user's domain doesn't match the FQDN of the jabber
-		 * service
-		 */
 
-		js->sasl_state = sasl_client_new("xmpp", js->user->domain, NULL, NULL, js->sasl_cb, 0, &js->sasl);
+		js->sasl_state = sasl_client_new("xmpp", js->serverFQDN, NULL, NULL, js->sasl_cb, 0, &js->sasl);
 		if (js->sasl_state==SASL_OK) {
 			sasl_setprop(js->sasl, SASL_SEC_PROPS, &secprops);
 			gaim_debug_info("sasl", "Mechs found: %s\n", js->sasl_mechs->str);
@@ -261,6 +256,12 @@
 				 * Presumably, if we get here that isn't the case and we shouldn't try again?
 				 * I suspect that this never happens.
 				 */
+				/*
+				 * SXW: Yes, this is right. What this handles is the situation where a
+				 * mechanism, say GSSAPI, is tried. If that mechanism fails, it may be
+				 * due to mechanism specific issues, so we want to try one of the other
+				 * supported mechanisms. This code handles that case
+				 */
 				if (mech && strlen(mech) > 0) {
 					char *pos;
 					if ((pos = strstr(js->sasl_mechs->str, mech))) {
--- a/libpurple/protocols/jabber/jabber.c	Mon Feb 26 09:41:38 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sat Mar 03 19:18:38 2007 +0000
@@ -504,6 +504,10 @@
 
 static void jabber_login_connect(JabberStream *js, const char *server, int port)
 {
+#ifdef HAVE_CYRUS_SASL
+	js->serverFQDN = g_strdup(server);
+#endif
+
 	if (gaim_proxy_connect(js->gc, js->gc->account, server,
 			port, jabber_login_callback, js->gc) == NULL)
 		gaim_connection_error(js->gc, _("Unable to create socket"));
@@ -1007,6 +1011,8 @@
 		g_string_free(js->sasl_mechs, TRUE);
 	if(js->sasl_cb)
 		g_free(js->sasl_cb);
+	if(js->serverFQDN)
+		g_free(js->serverFQDN);
 #endif
 	g_free(js->server_name);
 	g_free(js->gmail_last_time);
--- a/libpurple/protocols/jabber/jabber.h	Mon Feb 26 09:41:38 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.h	Sat Mar 03 19:18:38 2007 +0000
@@ -123,7 +123,7 @@
 	GSList *pending_avatar_requests;
 
 	GSList *pending_buddy_info_requests;
-		
+
 	GaimCircBuffer *write_buffer;
 	guint writeh;
 
@@ -132,7 +132,7 @@
 	JabberCapabilities server_caps;
 	gboolean googletalk;
 	char *server_name;
-  
+
 	char *gmail_last_time;
 	char *gmail_last_tid;
 
@@ -145,6 +145,7 @@
 	int sasl_state;
 	int sasl_maxbuf;
 	GString *sasl_mechs;
+	char *serverFQDN;
 #endif
 
 } JabberStream;