| 36 #include "jabber.h" |
36 #include "jabber.h" |
| 37 #include "jutil.h" |
37 #include "jutil.h" |
| 38 #include "iq.h" |
38 #include "iq.h" |
| 39 #include "notify.h" |
39 #include "notify.h" |
| 40 |
40 |
| 41 #include "ciphers/hmac.h" |
41 #include "ciphers/hmaccipher.h" |
| 42 #include "ciphers/md5.h" |
42 #include "ciphers/md5hash.h" |
| 43 |
43 |
| 44 static GSList *auth_mechs = NULL; |
44 static GSList *auth_mechs = NULL; |
| 45 |
45 |
| 46 static void auth_old_result_cb(JabberStream *js, const char *from, |
46 static void auth_old_result_cb(JabberStream *js, const char *from, |
| 47 JabberIqType type, const char *id, |
47 JabberIqType type, const char *id, |
| 276 /* For future reference, this appears to be a custom OS X extension |
276 /* For future reference, this appears to be a custom OS X extension |
| 277 * to non-SASL authentication. |
277 * to non-SASL authentication. |
| 278 */ |
278 */ |
| 279 const char *challenge; |
279 const char *challenge; |
| 280 gchar digest[33]; |
280 gchar digest[33]; |
| 281 PurpleCipher *hmac, *md5; |
281 PurpleCipher *hmac; |
| |
282 PurpleHash *md5; |
| 282 |
283 |
| 283 /* Calculate the MHAC-MD5 digest */ |
284 /* Calculate the MHAC-MD5 digest */ |
| 284 md5 = purple_md5_cipher_new(); |
285 md5 = purple_md5_hash_new(); |
| 285 hmac = purple_hmac_cipher_new(md5); |
286 hmac = purple_hmac_cipher_new(md5); |
| 286 challenge = xmlnode_get_attrib(x, "challenge"); |
287 challenge = xmlnode_get_attrib(x, "challenge"); |
| 287 purple_cipher_set_key(hmac, (guchar *)pw, strlen(pw)); |
288 purple_cipher_set_key(hmac, (guchar *)pw, strlen(pw)); |
| 288 purple_cipher_append(hmac, (guchar *)challenge, strlen(challenge)); |
289 purple_cipher_append(hmac, (guchar *)challenge, strlen(challenge)); |
| 289 purple_cipher_digest_to_str(hmac, digest, 33); |
290 purple_cipher_digest_to_str(hmac, digest, 33); |