Mercurial > pidgin.yaz
comparison libpurple/protocols/qq/qq_base.c @ 24601:fecedf6d9ee1
propagate from branch 'im.pidgin.pidgin' (head 97d295a04f3a9852a3b29cf0df43d56d1ddcc672)
to branch 'im.pidgin.pidgin.openq' (head a0d99396d1603b53838d74cad4391ece34f3ebbf)
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Fri, 05 Dec 2008 14:51:36 +0000 |
parents | 75545fdf8944 d8af9602c1b1 |
children | 2f84f888d3db |
comparison
equal
deleted
inserted
replaced
24536:c457c635eb8f | 24601:fecedf6d9ee1 |
---|---|
66 struct tm *tm_local; | 66 struct tm *tm_local; |
67 | 67 |
68 qd = (qq_data *) gc->proto_data; | 68 qd = (qq_data *) gc->proto_data; |
69 /* qq_show_packet("Login reply", data, len); */ | 69 /* qq_show_packet("Login reply", data, len); */ |
70 | 70 |
71 if (len < 139) { | 71 if (len < 148) { |
72 qq_show_packet("Login reply OK, but length < 139", data, len); | |
72 purple_connection_error_reason(gc, | 73 purple_connection_error_reason(gc, |
73 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, | 74 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
74 _("Can not decrypt server reply")); | 75 _("Can not decrypt server reply")); |
75 return QQ_LOGIN_REPLY_ERR; | 76 return QQ_LOGIN_REPLY_ERR; |
76 } | 77 } |
80 bytes += qq_getdata(qd->session_key, sizeof(qd->session_key), data + bytes); | 81 bytes += qq_getdata(qd->session_key, sizeof(qd->session_key), data + bytes); |
81 get_session_md5(qd->session_md5, qd->uid, qd->session_key); | 82 get_session_md5(qd->session_md5, qd->uid, qd->session_key); |
82 purple_debug_info("QQ", "Got session_key\n"); | 83 purple_debug_info("QQ", "Got session_key\n"); |
83 bytes += qq_get32(&uid, data + bytes); | 84 bytes += qq_get32(&uid, data + bytes); |
84 if (uid != qd->uid) { | 85 if (uid != qd->uid) { |
85 purple_debug_warning("QQ", "My uid in login reply is %d, not %d\n", uid, qd->uid); | 86 purple_debug_warning("QQ", "My uid in login reply is %u, not %u\n", uid, qd->uid); |
86 } | 87 } |
87 bytes += qq_getIP(&qd->my_ip, data + bytes); | 88 bytes += qq_getIP(&qd->my_ip, data + bytes); |
88 bytes += qq_get16(&qd->my_port, data + bytes); | 89 bytes += qq_get16(&qd->my_port, data + bytes); |
89 purple_debug_info("QQ", "Internet IP: %s, %d\n", inet_ntoa(qd->my_ip), qd->my_port); | 90 purple_debug_info("QQ", "Internet IP: %s, %d\n", inet_ntoa(qd->my_ip), qd->my_port); |
90 | 91 |
135 purple_debug_info("QQ", "Time: %d-%d-%d, %d:%d:%d\n", | 136 purple_debug_info("QQ", "Time: %d-%d-%d, %d:%d:%d\n", |
136 (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, | 137 (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, |
137 tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); | 138 tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); |
138 /* unknow 9 bytes, 0x(00 0a 00 0a 01 00 00 0e 10) */ | 139 /* unknow 9 bytes, 0x(00 0a 00 0a 01 00 00 0e 10) */ |
139 | 140 |
140 if (len > 139) { | 141 if (len > 148) { |
141 purple_debug_warning("QQ", "Login reply more than expected %d bytes, read %d bytes\n", 139, bytes); | 142 qq_show_packet("Login reply OK, but length > 139", data, len); |
142 } | 143 } |
143 return QQ_LOGIN_REPLY_OK; | 144 return QQ_LOGIN_REPLY_OK; |
144 } | 145 } |
145 | 146 |
146 /* process login reply packet which includes redirected new server address */ | 147 /* process login reply packet which includes redirected new server address */ |
328 } | 329 } |
329 | 330 |
330 if (bytes + token_len > buf_len) { | 331 if (bytes + token_len > buf_len) { |
331 purple_debug_info("QQ", "Extra token data, %d %d\n", token_len, buf_len - bytes); | 332 purple_debug_info("QQ", "Extra token data, %d %d\n", token_len, buf_len - bytes); |
332 } | 333 } |
333 qq_show_packet("Got token", buf + bytes, buf_len - bytes); | 334 /* qq_show_packet("Got token", buf + bytes, buf_len - bytes); */ |
334 | 335 |
335 if (qd->ld.token != NULL) { | 336 if (qd->ld.token != NULL) { |
336 g_free(qd->ld.token); | 337 g_free(qd->ld.token); |
337 qd->ld.token = NULL; | 338 qd->ld.token = NULL; |
338 qd->ld.token_len = 0; | 339 qd->ld.token_len = 0; |
1277 purple_debug_info("QQ", "Got session_key\n"); | 1278 purple_debug_info("QQ", "Got session_key\n"); |
1278 get_session_md5(qd->session_md5, qd->uid, qd->session_key); | 1279 get_session_md5(qd->session_md5, qd->uid, qd->session_key); |
1279 | 1280 |
1280 bytes += qq_get32(&uid, data + bytes); | 1281 bytes += qq_get32(&uid, data + bytes); |
1281 if (uid != qd->uid) { | 1282 if (uid != qd->uid) { |
1282 purple_debug_warning("QQ", "My uid in login reply is %d, not %d\n", uid, qd->uid); | 1283 purple_debug_warning("QQ", "My uid in login reply is %u, not %u\n", uid, qd->uid); |
1283 } | 1284 } |
1284 bytes += qq_getIP(&qd->my_ip, data + bytes); | 1285 bytes += qq_getIP(&qd->my_ip, data + bytes); |
1285 bytes += qq_get16(&qd->my_port, data + bytes); | 1286 bytes += qq_get16(&qd->my_port, data + bytes); |
1286 bytes += qq_getIP(&qd->my_local_ip, data + bytes); | 1287 bytes += qq_getIP(&qd->my_local_ip, data + bytes); |
1287 bytes += qq_get16(&qd->my_local_port, data + bytes); | 1288 bytes += qq_get16(&qd->my_local_port, data + bytes); |
1466 purple_debug_info("QQ", "Got session_key\n"); | 1467 purple_debug_info("QQ", "Got session_key\n"); |
1467 get_session_md5(qd->session_md5, qd->uid, qd->session_key); | 1468 get_session_md5(qd->session_md5, qd->uid, qd->session_key); |
1468 | 1469 |
1469 bytes += qq_get32(&uid, data + bytes); | 1470 bytes += qq_get32(&uid, data + bytes); |
1470 if (uid != qd->uid) { | 1471 if (uid != qd->uid) { |
1471 purple_debug_warning("QQ", "My uid in login reply is %d, not %d\n", uid, qd->uid); | 1472 purple_debug_warning("QQ", "My uid in login reply is %u, not %u\n", uid, qd->uid); |
1472 } | 1473 } |
1473 bytes += qq_getIP(&qd->my_ip, data + bytes); | 1474 bytes += qq_getIP(&qd->my_ip, data + bytes); |
1474 bytes += qq_get16(&qd->my_port, data + bytes); | 1475 bytes += qq_get16(&qd->my_port, data + bytes); |
1475 bytes += qq_getIP(&qd->my_local_ip, data + bytes); | 1476 bytes += qq_getIP(&qd->my_local_ip, data + bytes); |
1476 bytes += qq_get16(&qd->my_local_port, data + bytes); | 1477 bytes += qq_get16(&qd->my_local_port, data + bytes); |