pidgin: 41c412e5: MySpace? passwords are truncated to 10 c...

markdoliner at pidgin.im markdoliner at pidgin.im
Mon Jan 5 20:30:46 EST 2009


-----------------------------------------------------------------
Revision: 41c412e5bcee049646cb4edff0202f37b2cfb972
Ancestor: 9a6e678e1b903472c09c863de7b7b44d559d5860
Author: markdoliner at pidgin.im
Date: 2009-01-06T01:25:17
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/41c412e5bcee049646cb4edff0202f37b2cfb972

Modified files:
        libpurple/protocols/myspace/myspace.c

ChangeLog: 

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).

-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/myspace.c	fbc92dbf6b0e3598b173a27046e88394eac9d924
+++ libpurple/protocols/myspace/myspace.c	06bd6b8eb8bb5203420dda2c96e632530afd61a1
@@ -533,7 +533,7 @@ msim_compute_login_response(const gchar 
 
 	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 @@ msim_compute_login_response(const gchar 
 	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 @@ msim_compute_login_response(const gchar 
 			&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",


More information about the Commits mailing list