pidgin: c63a4c55: Truncate password to 16 characters on MS

nosnilmot at pidgin.im nosnilmot at pidgin.im
Fri Feb 29 16:15:49 EST 2008


-----------------------------------------------------------------
Revision: c63a4c55b97760fdff56cbf2e3c3530618fef208
Ancestor: abbb66c9fb99aeb13a85978aef9056745938f1c6
Author: nosnilmot at pidgin.im
Date: 2008-02-29T21:11:47
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c63a4c55b97760fdff56cbf2e3c3530618fef208

Modified files:
        libpurple/protocols/msnp9/nexus.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/msnp9/nexus.c	448cdbc53485623d080dd54ad33f60147ba379ce
+++ libpurple/protocols/msnp9/nexus.c	80d89e3a24685afd7230a16037123b06d483c694
@@ -321,7 +321,7 @@ login_connect_cb(gpointer data, PurpleSs
 {
 	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 @@ login_connect_cb(gpointer data, PurpleSs
 	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 @@ login_connect_cb(gpointer data, PurpleSs
 		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 @@ login_connect_cb(gpointer data, PurpleSs
 	g_free(head);
 	g_free(tail);
 	g_free(username);
-	g_free(password);
+	g_free(encpass);
 
 	nexus->write_buf = request_str;
 	nexus->written_len = 0;


More information about the Commits mailing list