changeset 30270:552616f49f94

jabber: Use the auth_mech_data JabberStream member for what it's for.
author Paul Aurich <paul@darkrain42.org>
date Sat, 01 May 2010 05:53:50 +0000
parents 702ea988070c
children a54e59c1c520
files libpurple/protocols/jabber/auth_digest_md5.c libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.h
diffstat 3 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/auth_digest_md5.c	Sat May 01 02:36:27 2010 +0000
+++ b/libpurple/protocols/jabber/auth_digest_md5.c	Sat May 01 05:53:50 2010 +0000
@@ -188,16 +188,17 @@
 
 	if (g_hash_table_lookup(parts, "rspauth")) {
 		char *rspauth = g_hash_table_lookup(parts, "rspauth");
+		char *expected_rspauth = js->auth_mech_data;
 
-		if (rspauth && purple_strequal(rspauth, js->expected_rspauth)) {
+		if (rspauth && purple_strequal(rspauth, expected_rspauth)) {
 			reply = xmlnode_new("response");
 			xmlnode_set_namespace(reply, NS_XMPP_SASL);
 		} else {
 			*msg = g_strdup(_("Invalid challenge from server"));
 			state = JABBER_SASL_STATE_FAIL;
 		}
-		g_free(js->expected_rspauth);
-		js->expected_rspauth = NULL;
+		g_free(js->auth_mech_data);
+		js->auth_mech_data = NULL;
 	} else {
 		/* assemble a response, and send it */
 		/* see RFC 2831 */
@@ -235,7 +236,7 @@
 			g_free(a2);
 
 			a2 = g_strdup_printf(":xmpp/%s", realm);
-			js->expected_rspauth = generate_response_value(js->user,
+			js->auth_mech_data = generate_response_value(js->user,
 					purple_connection_get_password(js->gc), nonce, cnonce, a2, realm);
 			g_free(a2);
 
@@ -276,6 +277,12 @@
 	return state;
 }
 
+static void
+digest_md5_dispose(JabberStream *js)
+{
+	g_free(js->auth_mech_data);
+}
+
 static JabberSaslMech digest_md5_mech = {
 	10, /* priority */
 	"DIGEST-MD5", /* name */
@@ -283,7 +290,7 @@
 	digest_md5_handle_challenge,
 	NULL, /* handle_success */
 	NULL, /* handle_failure */
-	NULL  /* handle_dispose */
+	digest_md5_dispose,
 };
 
 JabberSaslMech *jabber_auth_get_digest_md5_mech(void)
--- a/libpurple/protocols/jabber/jabber.c	Sat May 01 02:36:27 2010 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sat May 01 05:53:50 2010 +0000
@@ -1584,7 +1584,6 @@
 	g_free(js->old_source);
 	g_free(js->old_uri);
 	g_free(js->old_track);
-	g_free(js->expected_rspauth);
 
 	if (js->vcard_timer != 0)
 		purple_timeout_remove(js->vcard_timer);
--- a/libpurple/protocols/jabber/jabber.h	Sat May 01 02:36:27 2010 +0000
+++ b/libpurple/protocols/jabber/jabber.h	Sat May 01 05:53:50 2010 +0000
@@ -112,7 +112,7 @@
 
 	JabberSaslMech *auth_mech;
 	gpointer auth_mech_data;
-	
+
 	/**
 	 * The header from the opening <stream/> tag.  This being NULL is treated
 	 * as a special condition in the parsing code (signifying the next
@@ -122,9 +122,6 @@
 	char *stream_id;
 	JabberStreamState state;
 
-	/* SASL authentication */
-	char *expected_rspauth;
-
 	GHashTable *buddies;
 
 	/*