Mercurial > pidgin.yaz
comparison libfaim/aim_login.c @ 840:595ac7759563
[gaim-migrate @ 850]
lots of (mostly useless for us) libfaim changes. should help portability, but it was always portable between unices.... stupid win32ers.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 04 Sep 2000 23:37:32 +0000 |
parents | 72e556f6b99d |
children | e1da6a6ec42b |
comparison
equal
deleted
inserted
replaced
839:8f66e00af045 | 840:595ac7759563 |
---|---|
16 */ | 16 */ |
17 #ifdef TIS_TELNET_PROXY | 17 #ifdef TIS_TELNET_PROXY |
18 #include "tis_telnet_proxy.h" | 18 #include "tis_telnet_proxy.h" |
19 #endif | 19 #endif |
20 | 20 |
21 int aim_sendconnack(struct aim_session_t *sess, | 21 faim_export int aim_sendconnack(struct aim_session_t *sess, |
22 struct aim_conn_t *conn) | 22 struct aim_conn_t *conn) |
23 { | 23 { |
24 int curbyte=0; | 24 int curbyte=0; |
25 | 25 |
26 struct command_tx_struct *newpacket; | 26 struct command_tx_struct *newpacket; |
27 | 27 |
43 * for verification. If the name is invalid, a 0017/0003 | 43 * for verification. If the name is invalid, a 0017/0003 |
44 * is spit back, with the standard error contents. If valid, | 44 * is spit back, with the standard error contents. If valid, |
45 * a 0017/0007 comes back, which is the signal to send | 45 * a 0017/0007 comes back, which is the signal to send |
46 * it the main login command (0017/0002). | 46 * it the main login command (0017/0002). |
47 */ | 47 */ |
48 int aim_request_login(struct aim_session_t *sess, | 48 faim_export int aim_request_login(struct aim_session_t *sess, |
49 struct aim_conn_t *conn, | 49 struct aim_conn_t *conn, |
50 char *sn) | 50 char *sn) |
51 { | 51 { |
52 int curbyte=0; | 52 int curbyte=0; |
53 | 53 |
54 struct command_tx_struct *newpacket; | 54 struct command_tx_struct *newpacket; |
55 | 55 |
73 * The password is encoded before transmition, as per | 73 * The password is encoded before transmition, as per |
74 * encode_password(). See that function for their | 74 * encode_password(). See that function for their |
75 * stupid method of doing it. | 75 * stupid method of doing it. |
76 * | 76 * |
77 */ | 77 */ |
78 int aim_send_login (struct aim_session_t *sess, | 78 faim_export int aim_send_login (struct aim_session_t *sess, |
79 struct aim_conn_t *conn, | 79 struct aim_conn_t *conn, |
80 char *sn, char *password, struct client_info_s *clientinfo, | 80 char *sn, char *password, |
81 char *key) | 81 struct client_info_s *clientinfo, |
82 char *key) | |
82 { | 83 { |
83 int curbyte=0; | 84 int curbyte=0; |
84 md5_byte_t digest[16]; | 85 md5_byte_t digest[16]; |
85 | 86 |
86 struct command_tx_struct *newpacket; | 87 struct command_tx_struct *newpacket; |
98 curbyte = aim_putsnac(newpacket->data+curbyte, 0x0017, 0x0002, 0x0000, 0x00010000); | 99 curbyte = aim_putsnac(newpacket->data+curbyte, 0x0017, 0x0002, 0x0000, 0x00010000); |
99 | 100 |
100 curbyte+= aim_puttlv_str(newpacket->data+curbyte, 0x0001, strlen(sn), sn); | 101 curbyte+= aim_puttlv_str(newpacket->data+curbyte, 0x0001, strlen(sn), sn); |
101 | 102 |
102 aim_encode_password_md5(password, key, digest); | 103 aim_encode_password_md5(password, key, digest); |
103 curbyte+= aim_puttlv_str(newpacket->data+curbyte, 0x0025, 16, digest); | 104 curbyte+= aim_puttlv_str(newpacket->data+curbyte, 0x0025, 16, (char *)digest); |
104 | 105 |
105 /* XXX is clientstring required by oscar? */ | 106 /* XXX is clientstring required by oscar? */ |
106 if (strlen(clientinfo->clientstring)) | 107 if (strlen(clientinfo->clientstring)) |
107 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0003, strlen(clientinfo->clientstring), clientinfo->clientstring); | 108 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0003, strlen(clientinfo->clientstring), clientinfo->clientstring); |
108 | 109 |
195 * | 196 * |
196 * The client should check the value of logininfo->errorcode. If | 197 * The client should check the value of logininfo->errorcode. If |
197 * its nonzero, there was an error. | 198 * its nonzero, there was an error. |
198 * | 199 * |
199 */ | 200 */ |
200 int aim_authparse(struct aim_session_t *sess, | 201 faim_internal int aim_authparse(struct aim_session_t *sess, |
201 struct command_rx_struct *command) | 202 struct command_rx_struct *command) |
202 { | 203 { |
203 struct aim_tlvlist_t *tlvlist; | 204 struct aim_tlvlist_t *tlvlist; |
204 int ret = 1; | 205 int ret = 1; |
205 char *sn; | 206 char *sn; |
206 rxcallback_t userfunc = NULL; | 207 rxcallback_t userfunc = NULL; |
296 * by only its length in a two byte word. | 297 * by only its length in a two byte word. |
297 * | 298 * |
298 * Calls the client, which should then use the value to call aim_send_login. | 299 * Calls the client, which should then use the value to call aim_send_login. |
299 * | 300 * |
300 */ | 301 */ |
301 int aim_authkeyparse(struct aim_session_t *sess, struct command_rx_struct *command) | 302 faim_internal int aim_authkeyparse(struct aim_session_t *sess, struct command_rx_struct *command) |
302 { | 303 { |
303 unsigned char *key; | 304 unsigned char *key; |
304 int keylen; | 305 int keylen; |
305 int ret = 1; | 306 int ret = 1; |
306 rxcallback_t userfunc; | 307 rxcallback_t userfunc; |
310 return ret; | 311 return ret; |
311 memcpy(key, command->data+12, keylen); | 312 memcpy(key, command->data+12, keylen); |
312 key[keylen] = '\0'; | 313 key[keylen] = '\0'; |
313 | 314 |
314 if ((userfunc = aim_callhandler(command->conn, 0x0017, 0x0007))) | 315 if ((userfunc = aim_callhandler(command->conn, 0x0017, 0x0007))) |
315 ret = userfunc(sess, command, key); | 316 ret = userfunc(sess, command, (char *)key); |
316 | 317 |
317 free(key); | 318 free(key); |
318 | 319 |
319 return ret; | 320 return ret; |
320 } | 321 } |
323 * Generate an authorization response. | 324 * Generate an authorization response. |
324 * | 325 * |
325 * You probably don't want this unless you're writing an AIM server. | 326 * You probably don't want this unless you're writing an AIM server. |
326 * | 327 * |
327 */ | 328 */ |
328 unsigned long aim_sendauthresp(struct aim_session_t *sess, | 329 faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess, |
329 struct aim_conn_t *conn, | 330 struct aim_conn_t *conn, |
330 char *sn, char *bosip, | 331 char *sn, char *bosip, |
331 char *cookie, char *email, | 332 char *cookie, char *email, |
332 int regstatus) | 333 int regstatus) |
333 { | 334 { |
334 struct command_tx_struct *tx; | 335 struct command_tx_struct *tx; |
335 struct aim_tlvlist_t *tlvlist = NULL; | 336 struct aim_tlvlist_t *tlvlist = NULL; |
336 | 337 |
337 if (!(tx = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0004, conn, 1152))) | 338 if (!(tx = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0004, conn, 1152))) |
360 } | 361 } |
361 | 362 |
362 /* | 363 /* |
363 * Generate a random cookie. (Non-client use only) | 364 * Generate a random cookie. (Non-client use only) |
364 */ | 365 */ |
365 int aim_gencookie(unsigned char *buf) | 366 faim_export int aim_gencookie(unsigned char *buf) |
366 { | 367 { |
367 int i; | 368 int i; |
368 | 369 |
369 srand(time(NULL)); | 370 srand(time(NULL)); |
370 | 371 |
375 } | 376 } |
376 | 377 |
377 /* | 378 /* |
378 * Send Server Ready. (Non-client) | 379 * Send Server Ready. (Non-client) |
379 */ | 380 */ |
380 int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn) | 381 faim_export int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn) |
381 { | 382 { |
382 struct command_tx_struct *tx; | 383 struct command_tx_struct *tx; |
383 int i = 0; | 384 int i = 0; |
384 | 385 |
385 if (!(tx = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+0x22))) | 386 if (!(tx = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+0x22))) |
409 | 410 |
410 | 411 |
411 /* | 412 /* |
412 * Send service redirect. (Non-Client) | 413 * Send service redirect. (Non-Client) |
413 */ | 414 */ |
414 unsigned long aim_sendredirect(struct aim_session_t *sess, | 415 faim_export unsigned long aim_sendredirect(struct aim_session_t *sess, |
415 struct aim_conn_t *conn, | 416 struct aim_conn_t *conn, |
416 unsigned short servid, | 417 unsigned short servid, |
417 char *ip, | 418 char *ip, |
418 char *cookie) | 419 char *cookie) |
419 { | 420 { |
420 struct command_tx_struct *tx; | 421 struct command_tx_struct *tx; |
421 struct aim_tlvlist_t *tlvlist = NULL; | 422 struct aim_tlvlist_t *tlvlist = NULL; |
422 int i = 0; | 423 int i = 0; |
423 | 424 |