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