Mercurial > pidgin
diff libpurple/protocols/msn/directconn.c @ 30049:b0a7b31dcc5d
I think this finally works with both aMSN and the official client, for
receiving and sending, and with a couple possibilities for which one is
the listening client.
Refs #247.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Wed, 05 May 2010 07:32:45 +0000 |
parents | b491612862dc |
children | 99f81d97cbe6 |
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c Wed May 05 07:29:24 2010 +0000 +++ b/libpurple/protocols/msn/directconn.c Wed May 05 07:32:45 2010 +0000 @@ -663,23 +663,39 @@ memcpy(nonce, dc->in_buffer + 4 + offsetof(MsnDcContext, ack_id), 16); - msn_dc_calculate_nonce_hash(dc->nonce_type, nonce, nonce_hash); + if (dc->nonce_type == DC_NONCE_PLAIN) { + if (memcmp(dc->nonce, nonce, 16) == 0) { + purple_debug_info("msn", + "Nonce from buddy request and nonce from DC attempt match, " + "allowing direct connection\n"); + return TRUE; + } else { + purple_debug_warning("msn", + "Nonce from buddy request and nonce from DC attempt " + "don't match, ignoring direct connection\n"); + return FALSE; + } + + } else if (dc->nonce_type == DC_NONCE_SHA1) { + msn_dc_calculate_nonce_hash(dc->nonce_type, nonce, nonce_hash); - if (g_str_equal(dc->remote_nonce, nonce_hash)) { - purple_debug_info("msn", - "Received nonce %s from buddy request " - "and calculated nonce %s from DC attempt. " - "Nonces match, allowing direct connection\n", - dc->remote_nonce, nonce_hash); - return TRUE; - } else { - purple_debug_warning("msn", - "Received nonce %s from buddy request " - "and calculated nonce %s from DC attempt. " - "Nonces don't match, ignoring direct connection\n", - dc->remote_nonce, nonce_hash); + if (g_str_equal(dc->remote_nonce, nonce_hash)) { + purple_debug_info("msn", + "Received nonce %s from buddy request " + "and calculated nonce %s from DC attempt. " + "Nonces match, allowing direct connection\n", + dc->remote_nonce, nonce_hash); + return TRUE; + } else { + purple_debug_warning("msn", + "Received nonce %s from buddy request " + "and calculated nonce %s from DC attempt. " + "Nonces don't match, ignoring direct connection\n", + dc->remote_nonce, nonce_hash); + return FALSE; + } + } else return FALSE; - } } static void