gobjectification: 6b9c44c3: Make crammd5 auth on xmpp look like it m...

resiak at pidgin.im resiak at pidgin.im
Mon Aug 11 08:01:31 EDT 2008

Revision: 6b9c44c30918d3e338c77bd33ba1181e98e95453
Ancestor: b5610bfaad1cd99641345c501c48e47c92a45d4d
Author: resiak at pidgin.im
Date: 2008-07-10T13:21:06
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/6b9c44c30918d3e338c77bd33ba1181e98e95453

Modified files:


Make crammd5 auth on xmpp look like it might work again.  Specifically:
 * Initialize x to be the <crammd5> node
 * Set the hashing function to MD5
 * Set the key to the account password
using the old implementation as a guide.  I still can't connect to an xmpp
server without something spinning, but I think this auth method should now work
if we ever got that far.

-------------- next part --------------
--- libpurple/protocols/jabber/auth.c	4ef5e56cdf7a4ff3e4966ebd3f6579a12467395e
+++ libpurple/protocols/jabber/auth.c	d76417add4cdf552aa9620b22399a6103d90cb0c
@@ -641,15 +641,17 @@ static void auth_old_cb(JabberStream *js
 			jabber_iq_set_callback(iq, auth_old_result_cb, NULL);
-		} else if(js->stream_id && xmlnode_get_child(query, "crammd5")) {
+		} else if(js->stream_id && (x = xmlnode_get_child(query, "crammd5"))) {
 			const char *challenge;
 			guchar digest[33];
 			PurpleCipher *hmac;
-#warning Someone better double check this
+#warning Someone might want to triple-check this!
 			/* Calculate the MHAC-MD5 digest */
 			challenge = xmlnode_get_attrib(x, "challenge");
 			hmac = purple_hmac_cipher_new();
+			purple_cipher_set_hash(hmac, purple_md5_cipher_new());
+			purple_cipher_set_key(hmac, (guchar *)pw);
 			purple_cipher_append(hmac, (guchar*)challenge, strlen(challenge));
 			purple_cipher_digest(hmac, sizeof(digest), digest, NULL);

More information about the Commits mailing list