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