changeset 14046:eb1a7d176149

[gaim-migrate @ 16658] It has been too long since I did something productive here. Fix logging into yahoo with a password containing non-ascii characters. This fixes bug #1534796. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Sun, 06 Aug 2006 23:47:34 +0000
parents 3cefea0bf4a2
children c5bfede33622
files src/protocols/yahoo/yahoo.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c	Sun Aug 06 21:03:10 2006 +0000
+++ b/src/protocols/yahoo/yahoo.c	Sun Aug 06 23:47:34 2006 +0000
@@ -1241,6 +1241,7 @@
 	GaimAccount *account = gaim_connection_get_account(gc);
 	const char *name = gaim_normalize(account, gaim_account_get_username(account));
 	const char *pass = gaim_connection_get_password(gc);
+	char *enc_pass;
 	struct yahoo_data *yd = gc->proto_data;
 
 	GaimCipher			*md5_cipher;
@@ -1472,14 +1473,20 @@
 		magic_key_char[3] = (updated_key >> 24) & 0xff;
 	}
 
+	enc_pass = yahoo_string_encode(gc, pass, NULL);
+
 	/* Get password and crypt hashes as per usual. */
 	gaim_cipher_context_reset(md5_ctx, NULL);
-	gaim_cipher_context_append(md5_ctx, (const guchar *)pass, strlen(pass));
+	gaim_cipher_context_append(md5_ctx, (const guchar *)enc_pass, strlen(enc_pass));
 	gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest),
 							   md5_digest, NULL);
 	to_y64(password_hash, md5_digest, 16);
 
-	crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$");
+	crypt_result = yahoo_crypt(enc_pass, "$1$_2S43d5f$");
+
+	g_free(enc_pass);
+	enc_pass = NULL;
+
 	gaim_cipher_context_reset(md5_ctx, NULL);
 	gaim_cipher_context_append(md5_ctx, (const guchar *)crypt_result, strlen(crypt_result));
 	gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest),