Mercurial > pidgin
changeset 24914:1981b04de92e
MySpace? passwords are truncated to 10 characters. Their website doesn't
let you enter a password longer than that in the change password
interface, but it does let you enter more than 10 characters when logging
in (and they truncate it).
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 06 Jan 2009 01:25:17 +0000 |
parents | 702947c56bfa |
children | 568b786c36f9 |
files | libpurple/protocols/myspace/myspace.c |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Mon Jan 05 19:37:34 2009 +0000 +++ b/libpurple/protocols/myspace/myspace.c Tue Jan 06 01:25:17 2009 +0000 @@ -533,7 +533,7 @@ guchar hash_pw[HASH_SIZE]; guchar key[HASH_SIZE]; - gchar *password_utf16le, *password_utf8_lc; + gchar *password_truncated, *password_utf16le, *password_utf8_lc; GString *data; guchar *data_out; size_t data_out_len; @@ -548,10 +548,19 @@ g_return_val_if_fail(password != NULL, NULL); g_return_val_if_fail(response_len != NULL, NULL); + /* + * Truncate password to 10 characters. Their "change password" + * web page doesn't let you enter more than 10 characters, but you + * can enter more than 10 when logging in on myspace.com and they + * truncate it. + */ + password_truncated = g_strndup(password, 10); + /* Convert password to lowercase (required for passwords containing * uppercase characters). MySpace passwords are lowercase, * see ticket #2066. */ - password_utf8_lc = g_utf8_strdown(password, -1); + password_utf8_lc = g_utf8_strdown(password_truncated, -1); + g_free(password_truncated); /* Convert ASCII password to UTF16 little endian */ purple_debug_info("msim", "converting password to UTF-16LE\n"); @@ -560,8 +569,6 @@ &conv_bytes_read, &conv_bytes_written, &conv_error); g_free(password_utf8_lc); - g_return_val_if_fail(conv_bytes_read == strlen(password), NULL); - if (conv_error != NULL) { purple_debug_error("msim", "g_convert password UTF8->UTF16LE failed: %s",