comparison src/protocols/oscar/family_auth.c @ 13239:f260d319bbbc

[gaim-migrate @ 15605] Renaming a bunch of structs and typedefs to use the same naming scheme as the rest of Gaim committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 12 Feb 2006 16:02:05 +0000
parents f2431a7e33aa
children 87a7c3077c19
comparison
equal deleted inserted replaced
13238:1e855032d7bc 13239:f260d319bbbc
121 /* 121 /*
122 * The FLAP version is sent by itself at the beginning of authorization 122 * The FLAP version is sent by itself at the beginning of authorization
123 * connections. The FLAP version is also sent before the cookie when connecting 123 * connections. The FLAP version is also sent before the cookie when connecting
124 * for other services (BOS, chatnav, chat, etc.). 124 * for other services (BOS, chatnav, chat, etc.).
125 */ 125 */
126 faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn) 126 faim_export int aim_sendflapver(OscarSession *sess, OscarConnection *conn)
127 { 127 {
128 aim_frame_t *fr; 128 FlapFrame *fr;
129 129
130 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4))) 130 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4)))
131 return -ENOMEM; 131 return -ENOMEM;
132 132
133 aimbs_put32(&fr->data, 0x00000001); 133 aimbs_put32(&fr->data, 0x00000001);
143 * 143 *
144 * Very commonly used, as every connection except auth will require this to 144 * Very commonly used, as every connection except auth will require this to
145 * be the first thing you send. 145 * be the first thing you send.
146 * 146 *
147 */ 147 */
148 faim_export int aim_sendcookie(aim_session_t *sess, aim_conn_t *conn, const guint16 length, const guint8 *chipsahoy) 148 faim_export int aim_sendcookie(OscarSession *sess, OscarConnection *conn, const guint16 length, const guint8 *chipsahoy)
149 { 149 {
150 aim_frame_t *fr; 150 FlapFrame *fr;
151 aim_tlvlist_t *tl = NULL; 151 aim_tlvlist_t *tl = NULL;
152 152
153 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4+2+2+length))) 153 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4+2+2+length)))
154 return -ENOMEM; 154 return -ENOMEM;
155 155
165 165
166 #ifdef USE_XOR_FOR_ICQ 166 #ifdef USE_XOR_FOR_ICQ
167 /* 167 /*
168 * Part two of the ICQ hack. Note the ignoring of the key. 168 * Part two of the ICQ hack. Note the ignoring of the key.
169 */ 169 */
170 static int goddamnicq2(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password, struct client_info_s *ci) 170 static int goddamnicq2(OscarSession *sess, OscarConnection *conn, const char *sn, const char *password, ClientInfo *ci)
171 { 171 {
172 aim_frame_t *fr; 172 FlapFrame *fr;
173 aim_tlvlist_t *tl = NULL; 173 aim_tlvlist_t *tl = NULL;
174 int passwdlen; 174 int passwdlen;
175 guint8 *password_encoded; 175 guint8 *password_encoded;
176 176
177 passwdlen = strlen(password); 177 passwdlen = strlen(password);
228 * major = 0x0001 228 * major = 0x0001
229 * minor = 0x0001 229 * minor = 0x0001
230 * point = (not sent) 230 * point = (not sent)
231 * build = 0x0013 231 * build = 0x0013
232 * unknown= (not sent) 232 * unknown= (not sent)
233 * 233 *
234 * AIM for Linux 1.1.112: 234 * AIM for Linux 1.1.112:
235 * clientstring = "AOL Instant Messenger (SM)" 235 * clientstring = "AOL Instant Messenger (SM)"
236 * clientid = 0x1d09 236 * clientid = 0x1d09
237 * major = 0x0001 237 * major = 0x0001
238 * minor = 0x0001 238 * minor = 0x0001
240 * build = 0x0070 240 * build = 0x0070
241 * unknown= 0x0000008b 241 * unknown= 0x0000008b
242 * serverstore = 0x01 242 * serverstore = 0x01
243 * 243 *
244 */ 244 */
245 faim_export int aim_send_login(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password, struct client_info_s *ci, const char *key) 245 faim_export int aim_send_login(OscarSession *sess, OscarConnection *conn, const char *sn, const char *password, ClientInfo *ci, const char *key)
246 { 246 {
247 aim_frame_t *fr; 247 FlapFrame *fr;
248 aim_tlvlist_t *tl = NULL; 248 aim_tlvlist_t *tl = NULL;
249 guint8 digest[16]; 249 guint8 digest[16];
250 aim_snacid_t snacid; 250 aim_snacid_t snacid;
251 251
252 if (!ci || !sn || !password) 252 if (!ci || !sn || !password)
317 * presence of certain TLVs. 317 * presence of certain TLVs.
318 * 318 *
319 * The client should check the value passed as errorcode. If 319 * The client should check the value passed as errorcode. If
320 * its nonzero, there was an error. 320 * its nonzero, there was an error.
321 */ 321 */
322 static int parse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 322 static int parse(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs)
323 { 323 {
324 aim_tlvlist_t *tlvlist; 324 aim_tlvlist_t *tlvlist;
325 aim_rxcallback_t userfunc; 325 aim_rxcallback_t userfunc;
326 struct aim_authresp_info *info; 326 struct aim_authresp_info *info;
327 int ret = 0; 327 int ret = 0;
487 * 487 *
488 * XXX This may cause problems if the client relies on callbacks only 488 * XXX This may cause problems if the client relies on callbacks only
489 * being called from the context of aim_rxdispatch()... 489 * being called from the context of aim_rxdispatch()...
490 * 490 *
491 */ 491 */
492 static int goddamnicq(aim_session_t *sess, aim_conn_t *conn, const char *sn) 492 static int goddamnicq(OscarSession *sess, OscarConnection *conn, const char *sn)
493 { 493 {
494 aim_frame_t fr; 494 FlapFrame fr;
495 aim_rxcallback_t userfunc; 495 aim_rxcallback_t userfunc;
496 496
497 fr.conn = conn; 497 fr.conn = conn;
498 498
499 if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007))) 499 if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007)))
511 * invalid, a 0017/0003 is spit back, with the standard error contents. If 511 * invalid, a 0017/0003 is spit back, with the standard error contents. If
512 * valid, a 0017/0007 comes back, which is the signal to send it the main 512 * valid, a 0017/0007 comes back, which is the signal to send it the main
513 * login command (0017/0002). 513 * login command (0017/0002).
514 * 514 *
515 */ 515 */
516 faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn) 516 faim_export int aim_request_login(OscarSession *sess, OscarConnection *conn, const char *sn)
517 { 517 {
518 aim_frame_t *fr; 518 FlapFrame *fr;
519 aim_snacid_t snacid; 519 aim_snacid_t snacid;
520 aim_tlvlist_t *tl = NULL; 520 aim_tlvlist_t *tl = NULL;
521 521
522 if (!sess || !conn || !sn) 522 if (!sess || !conn || !sn)
523 return -EINVAL; 523 return -EINVAL;
558 * by only its length in a two byte word. 558 * by only its length in a two byte word.
559 * 559 *
560 * Calls the client, which should then use the value to call aim_send_login. 560 * Calls the client, which should then use the value to call aim_send_login.
561 * 561 *
562 */ 562 */
563 static int keyparse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 563 static int keyparse(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs)
564 { 564 {
565 int keylen, ret = 1; 565 int keylen, ret = 1;
566 aim_rxcallback_t userfunc; 566 aim_rxcallback_t userfunc;
567 char *keystr; 567 char *keystr;
568 568
584 /** 584 /**
585 * Subtype 0x000a 585 * Subtype 0x000a
586 * 586 *
587 * Receive SecurID request. 587 * Receive SecurID request.
588 */ 588 */
589 static int got_securid_request(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 589 static int got_securid_request(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs)
590 { 590 {
591 int ret = 0; 591 int ret = 0;
592 aim_rxcallback_t userfunc; 592 aim_rxcallback_t userfunc;
593 593
594 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 594 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
600 /** 600 /**
601 * Subtype 0x000b 601 * Subtype 0x000b
602 * 602 *
603 * Send SecurID response. 603 * Send SecurID response.
604 */ 604 */
605 faim_export int aim_auth_securid_send(aim_session_t *sess, const char *securid) 605 faim_export int aim_auth_securid_send(OscarSession *sess, const char *securid)
606 { 606 {
607 aim_conn_t *conn; 607 OscarConnection *conn;
608 aim_frame_t *fr; 608 FlapFrame *fr;
609 aim_snacid_t snacid; 609 aim_snacid_t snacid;
610 int len; 610 int len;
611 611
612 if (!sess || !(conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH)) || !securid) 612 if (!sess || !(conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH)) || !securid)
613 return -EINVAL; 613 return -EINVAL;
626 aim_tx_enqueue(sess, fr); 626 aim_tx_enqueue(sess, fr);
627 627
628 return 0; 628 return 0;
629 } 629 }
630 630
631 static void auth_shutdown(aim_session_t *sess, aim_module_t *mod) 631 static void auth_shutdown(OscarSession *sess, aim_module_t *mod)
632 { 632 {
633 if (sess->authinfo) { 633 if (sess->authinfo) {
634 free(sess->authinfo->sn); 634 free(sess->authinfo->sn);
635 free(sess->authinfo->bosip); 635 free(sess->authinfo->bosip);
636 free(sess->authinfo->errorurl); 636 free(sess->authinfo->errorurl);
644 free(sess->authinfo->latestbeta.info); 644 free(sess->authinfo->latestbeta.info);
645 free(sess->authinfo); 645 free(sess->authinfo);
646 } 646 }
647 } 647 }
648 648
649 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 649 static int snachandler(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs)
650 { 650 {
651 651
652 if (snac->subtype == 0x0003) 652 if (snac->subtype == 0x0003)
653 return parse(sess, mod, rx, snac, bs); 653 return parse(sess, mod, rx, snac, bs);
654 else if (snac->subtype == 0x0007) 654 else if (snac->subtype == 0x0007)
657 return got_securid_request(sess, mod, rx, snac, bs); 657 return got_securid_request(sess, mod, rx, snac, bs);
658 658
659 return 0; 659 return 0;
660 } 660 }
661 661
662 faim_internal int auth_modfirst(aim_session_t *sess, aim_module_t *mod) 662 faim_internal int auth_modfirst(OscarSession *sess, aim_module_t *mod)
663 { 663 {
664 664
665 mod->family = 0x0017; 665 mod->family = 0x0017;
666 mod->version = 0x0000; 666 mod->version = 0x0000;
667 mod->flags = 0; 667 mod->flags = 0;