Mercurial > pidgin.yaz
comparison src/protocols/oscar/auth.c @ 10464:61ef9a964574
[gaim-migrate @ 11739]
SecurID support for AIM. This is untested. I'll try to get it tested
in the next few days. I'm backporting this to oldstatus. If you don't
know what SecurID, google around for it.
Basically it's an optional additional authentication method that
AOL members can opt for (and pay an extra fee). After entering your
password, you are prompted for a 6 digit number from a digit readout/
keychain-sized LCD screen. This number is pseudo-random and changes
every 60 seconds.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 02 Jan 2005 07:20:38 +0000 |
parents | 9cafe038c95e |
children | cbbf5af9e520 |
comparison
equal
deleted
inserted
replaced
10463:9bed28273ec7 | 10464:61ef9a964574 |
---|---|
466 if (isdigit(sn[0])) | 466 if (isdigit(sn[0])) |
467 return goddamnicq(sess, conn, sn); | 467 return goddamnicq(sess, conn, sn); |
468 | 468 |
469 aim_sendflapver(sess, conn); | 469 aim_sendflapver(sess, conn); |
470 | 470 |
471 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(sn) /*+8*/ ))) | 471 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(sn)+8 ))) |
472 return -ENOMEM; | 472 return -ENOMEM; |
473 | 473 |
474 snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0); | 474 snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0); |
475 aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid); | 475 aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid); |
476 | 476 |
477 aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); | 477 aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); |
478 /* aim_tlvlist_add_noval(&tl, 0x004b); | 478 |
479 aim_tlvlist_add_noval(&tl, 0x005a); */ | 479 /* |
480 * These are sent in logins for recent WinAIM clients. Maybe tells | |
481 * the server we're able to handle SecurID requests? That's a complete | |
482 * guess. | |
483 */ | |
484 aim_tlvlist_add_noval(&tl, 0x004b); | |
485 aim_tlvlist_add_noval(&tl, 0x005a); | |
486 | |
480 aim_tlvlist_write(&fr->data, &tl); | 487 aim_tlvlist_write(&fr->data, &tl); |
481 aim_tlvlist_free(&tl); | 488 aim_tlvlist_free(&tl); |
482 | 489 |
483 aim_tx_enqueue(sess, fr); | 490 aim_tx_enqueue(sess, fr); |
484 | 491 |
511 ret = userfunc(sess, rx, keystr); | 518 ret = userfunc(sess, rx, keystr); |
512 | 519 |
513 free(keystr); | 520 free(keystr); |
514 | 521 |
515 return ret; | 522 return ret; |
523 } | |
524 | |
525 /** | |
526 * Subtype 0x000a | |
527 * | |
528 * Receive SecurID request. | |
529 */ | |
530 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) | |
531 { | |
532 int ret = 0; | |
533 aim_rxcallback_t userfunc; | |
534 | |
535 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) | |
536 ret = userfunc(sess, rx); | |
537 | |
538 return ret; | |
539 } | |
540 | |
541 /** | |
542 * Subtype 0x000b | |
543 * | |
544 * Send SecurID response. | |
545 */ | |
546 faim_export int aim_auth_securid_send(aim_session_t *sess, const char *securid) | |
547 { | |
548 aim_conn_t *conn; | |
549 aim_frame_t *fr; | |
550 aim_snacid_t snacid; | |
551 int len; | |
552 | |
553 if (!sess || !(conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH)) || !securid) | |
554 return -EINVAL; | |
555 | |
556 len = strlen(securid); | |
557 | |
558 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 10+2+len))) | |
559 return -ENOMEM; | |
560 | |
561 snacid = aim_cachesnac(sess, AIM_CB_FAM_ATH, AIM_CB_ATH_SECURID_RESPONSE, 0x0000, NULL, 0); | |
562 aim_putsnac(&fr->data, AIM_CB_FAM_ATH, AIM_CB_ATH_SECURID_RESPONSE, 0x0000, 0); | |
563 | |
564 aimbs_put16(&fr->data, len); | |
565 aimbs_putraw(&fr->data, securid, len); | |
566 | |
567 aim_tx_enqueue(sess, fr); | |
568 | |
569 return 0; | |
516 } | 570 } |
517 | 571 |
518 static void auth_shutdown(aim_session_t *sess, aim_module_t *mod) | 572 static void auth_shutdown(aim_session_t *sess, aim_module_t *mod) |
519 { | 573 { |
520 if (sess->authinfo) { | 574 if (sess->authinfo) { |
538 | 592 |
539 if (snac->subtype == 0x0003) | 593 if (snac->subtype == 0x0003) |
540 return parse(sess, mod, rx, snac, bs); | 594 return parse(sess, mod, rx, snac, bs); |
541 else if (snac->subtype == 0x0007) | 595 else if (snac->subtype == 0x0007) |
542 return keyparse(sess, mod, rx, snac, bs); | 596 return keyparse(sess, mod, rx, snac, bs); |
597 else if (snac->subtype == 0x000a) | |
598 return got_securid_request(sess, mod, rx, snac, bs); | |
543 | 599 |
544 return 0; | 600 return 0; |
545 } | 601 } |
546 | 602 |
547 faim_internal int auth_modfirst(aim_session_t *sess, aim_module_t *mod) | 603 faim_internal int auth_modfirst(aim_session_t *sess, aim_module_t *mod) |