diff src/protocols/oscar/auth.c @ 10712:b41c48d890d8

[gaim-migrate @ 12306] sf patch #1153243, from Richard Laager Implement IRC Response #437, "Nick or channel is temporarily unavailable." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 21 Mar 2005 03:37:59 +0000
parents f7431a6ff0cb
children d087e928ffd1
line wrap: on
line diff
--- a/src/protocols/oscar/auth.c	Mon Mar 21 02:14:46 2005 +0000
+++ b/src/protocols/oscar/auth.c	Mon Mar 21 03:37:59 2005 +0000
@@ -236,7 +236,19 @@
 
 	aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn);
 
-	aim_encode_password_md5(password, key, digest);
+	/* Truncate ICQ passwords, if necessary */
+	if (isdigit(sn[0]) && (strlen(password) > MAXICQPASSLEN))
+	{
+		char truncated[MAXICQPASSLEN + 1];
+		strncpy(truncated, password, MAXICQPASSLEN);
+		truncated[MAXICQPASSLEN] = 0;
+		aim_encode_password_md5(truncated, key, digest);
+	}
+	else
+	{
+		aim_encode_password_md5(password, key, digest);
+	}
+
 	aim_tlvlist_add_raw(&tl, 0x0025, 16, digest);
 
 #ifndef USE_OLD_MD5