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