# HG changeset patch # User Paul Aurich # Date 1275092190 0 # Node ID c4cac45b0a74e306f5d26d2036ed22f92409d904 # Parent bf088afdc8136c5d6bc5a8148f5b5e84b0739d75# Parent bc9f74e9f5960fe92084d39287f9115bdd0358f7 merge of '8955da011b0481f0598f9cb0ee24fc2184396c69' and '94fa017925fa206fc36f520ee42c54f57429b4e1' diff -r bf088afdc813 -r c4cac45b0a74 libpurple/protocols/msn/directconn.c --- a/libpurple/protocols/msn/directconn.c Sat May 29 00:08:23 2010 +0000 +++ b/libpurple/protocols/msn/directconn.c Sat May 29 00:16:30 2010 +0000 @@ -50,7 +50,6 @@ msn_dc_calculate_nonce_hash(MsnDirectConnNonceType type, const guchar nonce[16], gchar nonce_hash[37]) { - guint32 *tmp; guchar digest[20]; if (type == DC_NONCE_SHA1) { @@ -63,18 +62,29 @@ memcpy(digest, nonce, 16); } - /* TODO: Somebody please tell me why this first one causes a warning, - but the others don't! */ - tmp = (guint32 *)&digest[0]; + g_sprintf(nonce_hash, + "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", + + digest[3], + digest[2], + digest[1], + digest[0], + + digest[5], + digest[4], - g_sprintf(nonce_hash, - "%08X-%04X-%04X-%04X-%08X%04X", - GUINT32_FROM_LE(*tmp), - GUINT16_FROM_LE(*((guint16 *)(digest + 4))), - GUINT16_FROM_LE(*((guint16 *)(digest + 6))), - GUINT16_FROM_BE(*((guint16 *)(digest + 8))), - GUINT32_FROM_BE(*((guint32 *)(digest + 10))), - GUINT16_FROM_BE(*((guint16 *)(digest + 14))) + digest[7], + digest[6], + + digest[8], + digest[9], + + digest[10], + digest[11], + digest[12], + digest[13], + digest[14], + digest[15] ); } diff -r bf088afdc813 -r c4cac45b0a74 libpurple/protocols/msn/slp.c --- a/libpurple/protocols/msn/slp.c Sat May 29 00:08:23 2010 +0000 +++ b/libpurple/protocols/msn/slp.c Sat May 29 00:16:30 2010 +0000 @@ -288,11 +288,11 @@ if (nonce) { *ntype = DC_NONCE_SHA1; } else { - guint32 n1, n5; - guint16 n2, n3, n4, n6; + guint32 n1, n6; + guint16 n2, n3, n4, n5; nonce = get_token(content, "Nonce: {", "}\r\n"); if (nonce - && sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%08x%04hx", + && sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%04hx%08x", &n1, &n2, &n3, &n4, &n5, &n6) == 6) { *ntype = DC_NONCE_PLAIN; g_free(nonce); @@ -301,8 +301,8 @@ *(guint16 *)(nonce + 4) = GUINT16_TO_LE(n2); *(guint16 *)(nonce + 6) = GUINT16_TO_LE(n3); *(guint16 *)(nonce + 8) = GUINT16_TO_BE(n4); - *(guint32 *)(nonce + 10) = GUINT32_TO_BE(n5); - *(guint16 *)(nonce + 14) = GUINT16_TO_BE(n6); + *(guint16 *)(nonce + 10) = GUINT16_TO_BE(n5); + *(guint32 *)(nonce + 12) = GUINT32_TO_BE(n6); } else { /* Invalid nonce, so ignore request */ g_free(nonce); diff -r bf088afdc813 -r c4cac45b0a74 libpurple/protocols/msn/slplink.c --- a/libpurple/protocols/msn/slplink.c Sat May 29 00:08:23 2010 +0000 +++ b/libpurple/protocols/msn/slplink.c Sat May 29 00:16:30 2010 +0000 @@ -215,6 +215,7 @@ /* The slplink has no slpcalls in it, release it from the DC. */ if (slplink->slp_calls == NULL && slplink->dc != NULL) { + slplink->dc->slplink = NULL; msn_dc_destroy(slplink->dc); slplink->dc = NULL; }