changeset 22394:85fbff54425e

Truncate password to 16 characters on MSN, before encoding. This should fix connecting for people who thing they have a password longer than 16 characters, but don't actually (because it's not possible to set one). I tried this in 2.3.0 but got it badly wrong (truncated after encoding), and I've been scared off trying it again before now.
author Stu Tomlinson <stu@nosnilmot.com>
date Fri, 29 Feb 2008 21:11:47 +0000
parents 2d0bfa78f732
children 19f26913fe71 801116601a7b
files libpurple/protocols/msnp9/nexus.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msnp9/nexus.c	Fri Feb 29 20:23:02 2008 +0000
+++ b/libpurple/protocols/msnp9/nexus.c	Fri Feb 29 21:11:47 2008 +0000
@@ -321,7 +321,7 @@
 {
 	MsnNexus *nexus;
 	MsnSession *session;
-	char *username, *password;
+	char *username, *password, *encpass;
 	char *request_str, *head, *tail;
 	char *buffer = NULL;
 	guint32 ctint;
@@ -337,8 +337,9 @@
 	username =
 		g_strdup(purple_url_encode(purple_account_get_username(session->account)));
 
-	password =
-		g_strdup(purple_url_encode(purple_connection_get_password(session->account->gc)));
+	password = g_strndup(purple_connection_get_password(session->account->gc), 16);
+	encpass = g_strdup(purple_url_encode(password));
+	g_free(password);
 
 	ctint = strtoul((char *)g_hash_table_lookup(nexus->challenge_data, "ct"), NULL, 10) + 200;
 
@@ -368,7 +369,7 @@
 		nexus->login_host);
 
 	buffer = g_strdup_printf("%s,pwd=XXXXXXXX,%s\r\n", head, tail);
-	request_str = g_strdup_printf("%s,pwd=%s,%s\r\n", head, password, tail);
+	request_str = g_strdup_printf("%s,pwd=%s,%s\r\n", head, encpass, tail);
 
 	purple_debug_misc("msn", "Sending: {%s}\n", buffer);
 
@@ -376,7 +377,7 @@
 	g_free(head);
 	g_free(tail);
 	g_free(username);
-	g_free(password);
+	g_free(encpass);
 
 	nexus->write_buf = request_str;
 	nexus->written_len = 0;