Mercurial > pidgin.yaz
changeset 17941:dcbb535e8d55
Lowercase password before sending it. Closes #2066.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Wed, 11 Jul 2007 05:17:18 +0000 |
parents | 1f08b7a0fc12 |
children | 949fddc9d82f |
files | libpurple/protocols/myspace/myspace.c libpurple/protocols/myspace/myspace.h |
diffstat | 2 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Tue Jul 10 06:08:05 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Wed Jul 11 05:17:18 2007 +0000 @@ -356,9 +356,9 @@ purple_debug_info("msim", "nc is %d bytes, decoded\n", nc_len); - if (nc_len != 0x40) + if (nc_len != MSIM_AUTH_CHALLENGE_LENGTH) { - purple_debug_info("msim", "bad nc length: %x != 0x40\n", nc_len); + purple_debug_info("msim", "bad nc length: %x != 0x%x\n", nc_len, MSIM_AUTH_CHALLENGE_LENGTH); purple_connection_error(session->gc, _("Unexpected challenge length from server")); return FALSE; } @@ -403,7 +403,7 @@ guchar hash_pw[HASH_SIZE]; guchar key[HASH_SIZE]; - gchar *password_utf16le; + gchar *password_utf16le, *password_ascii_lc; guchar *data; guchar *data_out; size_t data_len, data_out_len; @@ -418,11 +418,18 @@ g_return_val_if_fail(password != NULL, NULL); g_return_val_if_fail(response_len != NULL, NULL); + /* Convert password to lowercase (required for passwords containing + * uppercase characters). MySpace passwords are lowercase, + * see ticket #2066. */ + password_ascii_lc = g_strdup(password); + g_strdown(password_ascii_lc); + /* Convert ASCII password to UTF16 little endian */ purple_debug_info("msim", "converting password to UTF-16LE\n"); conv_error = NULL; - password_utf16le = g_convert(password, -1, "UTF-16LE", "UTF-8", + password_utf16le = g_convert(password_ascii_lc, -1, "UTF-16LE", "UTF-8", &conv_bytes_read, &conv_bytes_written, &conv_error); + g_free(password_ascii_lc); g_return_val_if_fail(conv_bytes_read == strlen(password), NULL);
--- a/libpurple/protocols/myspace/myspace.h Tue Jul 10 06:08:05 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.h Wed Jul 11 05:17:18 2007 +0000 @@ -108,6 +108,9 @@ /* Authentication algorithm for login2 */ #define MSIM_AUTH_ALGORITHM 196610 +/* Recognized challenge length */ +#define MSIM_AUTH_CHALLENGE_LENGTH 0x40 + /* TODO: obtain IPs of network interfaces from user's machine, instead of * hardcoding these values below (used in msim_compute_login_response). * This is not immediately