Mercurial > pidgin
annotate libfaim/aim_auth.c @ 442:fbf45eb2cd4e
[gaim-migrate @ 452]
Fixed a small spacing issue.
committer: Tailor Script <tailor@pidgin.im>
| author | Rob Flynn <gaim@robflynn.com> |
|---|---|
| date | Thu, 29 Jun 2000 08:46:09 +0000 |
| parents | 0f14e6d8a51b |
| children | e4c34ca88d9b |
| rev | line source |
|---|---|
| 2 | 1 /* |
| 2 aim_auth.c | |
| 3 | |
| 4 Deals with the authorizer. | |
| 5 | |
| 6 */ | |
| 7 | |
|
283
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
8 #include <faim/aim.h> |
| 2 | 9 |
| 10 /* this just pushes the passed cookie onto the passed connection -- NO SNAC! */ | |
| 237 | 11 int aim_auth_sendcookie(struct aim_session_t *sess, |
| 12 struct aim_conn_t *conn, | |
| 13 u_char *chipsahoy) | |
| 2 | 14 { |
| 237 | 15 struct command_tx_struct *newpacket; |
| 2 | 16 int curbyte=0; |
| 17 | |
| 237 | 18 if (!(newpacket = aim_tx_new(0x0001, conn, 4+2+2+AIM_COOKIELEN))) |
| 19 return -1; | |
| 2 | 20 |
| 237 | 21 newpacket->lock = 1; |
| 2 | 22 |
| 237 | 23 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000); |
| 24 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); | |
| 25 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0006); | |
| 26 curbyte += aimutil_put16(newpacket->data+curbyte, AIM_COOKIELEN); | |
| 27 memcpy(newpacket->data+curbyte, chipsahoy, AIM_COOKIELEN); | |
| 2 | 28 |
| 237 | 29 return aim_tx_enqueue(sess, newpacket); |
| 2 | 30 } |
| 31 | |
| 237 | 32 u_long aim_auth_clientready(struct aim_session_t *sess, |
| 33 struct aim_conn_t *conn) | |
| 2 | 34 { |
| 237 | 35 struct command_tx_struct *newpacket; |
| 2 | 36 int curbyte = 0; |
| 37 | |
| 237 | 38 if (!(newpacket = aim_tx_new(0x0002, conn, 26))) |
| 39 return -1; | |
| 2 | 40 |
| 237 | 41 newpacket->lock = 1; |
| 2 | 42 |
| 237 | 43 curbyte += aim_putsnac(newpacket->data+curbyte, 0x0001, 0x0002, 0x0000, sess->snac_nextid); |
| 44 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); | |
| 45 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002); | |
| 46 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); | |
| 47 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0013); | |
| 48 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0007); | |
| 49 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); | |
| 50 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); | |
| 51 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); | |
| 2 | 52 |
| 237 | 53 aim_tx_enqueue(sess, newpacket); |
| 2 | 54 |
| 55 { | |
| 56 struct aim_snac_t snac; | |
| 57 | |
| 237 | 58 snac.id = sess->snac_nextid; |
| 2 | 59 snac.family = 0x0001; |
| 60 snac.type = 0x0004; | |
| 61 snac.flags = 0x0000; | |
| 62 | |
| 63 snac.data = NULL; | |
| 64 | |
| 237 | 65 aim_newsnac(sess, &snac); |
| 2 | 66 } |
| 67 | |
| 237 | 68 return (sess->snac_nextid++); |
| 2 | 69 } |
| 70 | |
| 237 | 71 u_long aim_auth_changepasswd(struct aim_session_t *sess, |
| 72 struct aim_conn_t *conn, | |
| 73 char *new, char *current) | |
| 2 | 74 { |
| 237 | 75 struct command_tx_struct *newpacket; |
| 2 | 76 int i; |
| 77 | |
| 237 | 78 if (!(newpacket = aim_tx_new(0x0002, conn, 10+4+strlen(current)+4+strlen(new)))) |
| 79 return -1; | |
| 2 | 80 |
| 237 | 81 newpacket->lock = 1; |
| 2 | 82 |
| 237 | 83 i = aim_putsnac(newpacket->data, 0x0007, 0x0004, 0x0000, sess->snac_nextid); |
| 2 | 84 |
| 85 /* current password TLV t(0002) */ | |
| 237 | 86 i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(current), current); |
| 2 | 87 |
| 88 /* new password TLV t(0012) */ | |
| 237 | 89 i += aim_puttlv_str(newpacket->data+i, 0x0012, strlen(new), new); |
| 2 | 90 |
| 237 | 91 aim_tx_enqueue(sess, newpacket); |
| 2 | 92 |
| 93 { | |
| 94 struct aim_snac_t snac; | |
| 95 | |
| 237 | 96 snac.id = sess->snac_nextid; |
| 2 | 97 snac.family = 0x0001; |
| 98 snac.type = 0x0004; | |
| 99 snac.flags = 0x0000; | |
| 100 | |
| 101 snac.data = NULL; | |
| 102 | |
| 237 | 103 aim_newsnac(sess, &snac); |
| 2 | 104 } |
| 105 | |
| 237 | 106 return (sess->snac_nextid++); |
| 2 | 107 } |
