]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | aim_auth.c | |
3 | ||
4 | Deals with the authorizer. | |
5 | ||
6 | */ | |
7 | ||
8 | #include <faim/aim.h> | |
9 | ||
10 | /* this just pushes the passed cookie onto the passed connection -- NO SNAC! */ | |
11 | faim_export int aim_auth_sendcookie(struct aim_session_t *sess, | |
12 | struct aim_conn_t *conn, | |
13 | unsigned char *chipsahoy) | |
14 | { | |
15 | struct command_tx_struct *newpacket; | |
16 | int curbyte=0; | |
17 | ||
18 | if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0001, conn, 4+2+2+AIM_COOKIELEN))) | |
19 | return -1; | |
20 | ||
21 | newpacket->lock = 1; | |
22 | ||
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); | |
28 | ||
29 | return aim_tx_enqueue(sess, newpacket); | |
30 | } | |
31 | ||
32 | faim_export unsigned long aim_auth_clientready(struct aim_session_t *sess, | |
33 | struct aim_conn_t *conn) | |
34 | { | |
35 | struct command_tx_struct *newpacket; | |
36 | int curbyte = 0; | |
37 | ||
38 | if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 26))) | |
39 | return -1; | |
40 | ||
41 | newpacket->lock = 1; | |
42 | ||
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); | |
52 | ||
53 | aim_tx_enqueue(sess, newpacket); | |
54 | ||
55 | aim_cachesnac(sess, 0x0001, 0x0004, 0x0000, NULL, 0); | |
56 | ||
57 | return sess->snac_nextid; | |
58 | } | |
59 | ||
60 | faim_export unsigned long aim_auth_changepasswd(struct aim_session_t *sess, | |
61 | struct aim_conn_t *conn, | |
62 | char *new, char *current) | |
63 | { | |
64 | struct command_tx_struct *newpacket; | |
65 | int i; | |
66 | ||
67 | if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+4+strlen(current)+4+strlen(new)))) | |
68 | return -1; | |
69 | ||
70 | newpacket->lock = 1; | |
71 | ||
72 | i = aim_putsnac(newpacket->data, 0x0007, 0x0004, 0x0000, sess->snac_nextid); | |
73 | ||
74 | /* current password TLV t(0002) */ | |
75 | i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(current), current); | |
76 | ||
77 | /* new password TLV t(0012) */ | |
78 | i += aim_puttlv_str(newpacket->data+i, 0x0012, strlen(new), new); | |
79 | ||
80 | aim_tx_enqueue(sess, newpacket); | |
81 | ||
82 | aim_cachesnac(sess, 0x0001, 0x0004, 0x0000, NULL, 0); | |
83 | ||
84 | return sess->snac_nextid; | |
85 | } |