pidgin: c4fac586: jabber: Use the auth_mech_data JabberStr...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sat May 1 12:45:46 EDT 2010


-----------------------------------------------------------------
Revision: c4fac586e2a3b1524463d90f3af97208cc00a5ee
Ancestor: 65e01fbe56cc5a1d342f7992538c09a59cb364a2
Author: darkrain42 at pidgin.im
Date: 2010-05-01T05:53:50
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c4fac586e2a3b1524463d90f3af97208cc00a5ee

Modified files:
        libpurple/protocols/jabber/auth_digest_md5.c
        libpurple/protocols/jabber/jabber.c
        libpurple/protocols/jabber/jabber.h

ChangeLog: 

jabber: Use the auth_mech_data JabberStream member for what it's for.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/auth_digest_md5.c	b71150d96183889e86e3eb285d1c636bc4c54952
+++ libpurple/protocols/jabber/auth_digest_md5.c	b27708b5c278d1e331e92af4f4fdca809c35f245
@@ -188,16 +188,17 @@ digest_md5_handle_challenge(JabberStream
 
 	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 @@ digest_md5_handle_challenge(JabberStream
 			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 @@ digest_md5_handle_challenge(JabberStream
 	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 @@ static JabberSaslMech digest_md5_mech = 
 	digest_md5_handle_challenge,
 	NULL, /* handle_success */
 	NULL, /* handle_failure */
-	NULL  /* handle_dispose */
+	digest_md5_dispose,
 };
 
 JabberSaslMech *jabber_auth_get_digest_md5_mech(void)
============================================================
--- libpurple/protocols/jabber/jabber.c	750dd2ba2ef135fd1b1fd0ecb3d6c96d39196aff
+++ libpurple/protocols/jabber/jabber.c	896c8cfd3cc7a6db6cd14f1cc58df4300f192133
@@ -1584,7 +1584,6 @@ void jabber_close(PurpleConnection *gc)
 	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);
============================================================
--- libpurple/protocols/jabber/jabber.h	1333c8be4cee4f3c2cecc7c62bd51a25cacc0023
+++ libpurple/protocols/jabber/jabber.h	86a671359b3665b429806ce52b5071fccc34f0f8
@@ -112,7 +112,7 @@ struct _JabberStream
 
 	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 @@ struct _JabberStream
 	char *stream_id;
 	JabberStreamState state;
 
-	/* SASL authentication */
-	char *expected_rspauth;
-
 	GHashTable *buddies;
 
 	/*


More information about the Commits mailing list