diff libgaim/protocols/qq/file_trans.c @ 14632:108152f29f37

[gaim-migrate @ 17378] There's no reason to generate our session_md5 more than once. This probably doesn't fix the bug from Adium crash 215722, but if it happens again, it'll be a bit easier to track down. Also, I was wrong about the login scheme. Nothing significant is different, so remove the comment. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Wed, 27 Sep 2006 00:31:39 +0000
parents 6b8bc59414f0
children d1a76ccb93c4
line wrap: on
line diff
--- a/libgaim/protocols/qq/file_trans.c	Tue Sep 26 23:20:39 2006 +0000
+++ b/libgaim/protocols/qq/file_trans.c	Wed Sep 27 00:31:39 2006 +0000
@@ -284,7 +284,7 @@
 {
 	qq_data *qd;
 	gint bytes, bytes_expected, encrypted_len;
-	guint8 *raw_data, *cursor, *encrypted_data, *md5;
+	guint8 *raw_data, *cursor, *encrypted_data;
 	time_t now;
 	ft_info *info;
 	
@@ -296,9 +296,8 @@
 	
 	bytes = 0;
 	now = time(NULL);
-	md5 = _gen_session_md5(qd->uid, qd->session_key);
 
-	bytes += create_packet_data(raw_data, &cursor, md5, 16);
+	bytes += create_packet_data(raw_data, &cursor, qd->session_md5, 16);
 	bytes += create_packet_w(raw_data, &cursor, packet_type);
 	switch (packet_type) {
 		case QQ_FILE_CMD_SENDER_SAY_HELLO:
@@ -377,8 +376,6 @@
 	else
 		gaim_debug(GAIM_DEBUG_ERROR, "QQ", "qq_send_file_ctl_packet: Expected to get %d bytes, but get %d",
 				bytes_expected, bytes);
-
-	g_free(md5);
 }
 
 /* send a file to udp channel with QQ_FILE_DATA_PACKET_TAG */
@@ -521,14 +518,12 @@
 	guint16 packet_type;
 	guint16 seq;
 	guint8 hellobyte;
-	guint8 *md5;
 	ft_info *info = (ft_info *) qd->xfer->data;
 
 	decrypted_data = g_newa(guint8, len);
 	decrypted_len = len;
 
-	md5 = _gen_session_md5(qd->uid, qd->session_key);
-	if (qq_crypt(DECRYPT, cursor, len - (cursor - data), md5, decrypted_data, &decrypted_len)) {
+	if (qq_crypt(DECRYPT, cursor, len - (cursor - data), qd->session_md5, decrypted_data, &decrypted_len)) {
 		cursor = decrypted_data + 16;	/* skip md5 section */
 		read_packet_w(decrypted_data, &cursor, decrypted_len, &packet_type);
 		read_packet_w(decrypted_data, &cursor, decrypted_len, &seq);
@@ -577,7 +572,6 @@
 				gaim_debug(GAIM_DEBUG_INFO, "QQ", "unprocess file command %d\n", packet_type);
 		}
 	} 
-	g_free(md5);
 }
 
 static void _qq_recv_file_progess(GaimConnection *gc, guint8 *buffer, guint16 len, guint32 index, guint32 offset)