annotate libfaim/login.c @ 1815:f15d449b3167

[gaim-migrate @ 1825] I am IRON MAN committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 06 May 2001 09:20:03 +0000
parents d2eca7a46cfd
children 109cacf1ff97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * aim_login.c
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * This contains all the functions needed to actually login.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 #define FAIM_INTERNAL
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 #include <aim.h>
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 #include "md5.h"
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 static int aim_encode_password(const char *password, unsigned char *encoded);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 faim_export int aim_sendconnack(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 struct aim_conn_t *conn)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 int curbyte=0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 struct command_tx_struct *newpacket;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0001, 4)))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 newpacket->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 newpacket->lock = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 return aim_tx_enqueue(sess, newpacket);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 * In AIM 3.5 protocol, the first stage of login is to request
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 * login from the Authorizer, passing it the screen name
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 * for verification. If the name is invalid, a 0017/0003
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 * is spit back, with the standard error contents. If valid,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 * a 0017/0007 comes back, which is the signal to send
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 * it the main login command (0017/0002).
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 faim_export int aim_request_login(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 struct aim_conn_t *conn,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 char *sn)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 int curbyte;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 struct command_tx_struct *newpacket;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 if (!sess || !conn || !sn)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 * For ICQ, we enable the ancient horrible login and stuff
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 * a key packet into the queue to make it look like we got
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 * a reply back. This is so the client doesn't know we're
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 * really not doing MD5 login.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 * This may sound stupid, but I'm not in the best of moods and
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 * I don't plan to keep support for this crap around much longer.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 * Its all AOL's fault anyway, really. I hate AOL. Really. They
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 * always seem to be able to piss me off by doing the dumbest little
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 * things. Like disabling MD5 logins for ICQ UINs, or adding purposefully
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 * wrong TLV lengths, or adding superfluous information to host strings,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 * or... I'll stop.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 if ((sn[0] >= '0') && (sn[0] <= '9')) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 struct command_rx_struct *newrx;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 int i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 if (!(newrx = (struct command_rx_struct *)malloc(sizeof(struct command_rx_struct))))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 memset(newrx, 0x00, sizeof(struct command_rx_struct));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 newrx->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 newrx->hdrtype = AIM_FRAMETYPE_OSCAR;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76 newrx->hdr.oscar.type = 0x02;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 newrx->hdr.oscar.seqnum = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 newrx->commandlen = 10+2+1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 newrx->nofree = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 if (!(newrx->data = malloc(newrx->commandlen))) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81 free(newrx);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 i = aim_putsnac(newrx->data, 0x0017, 0x0007, 0x0000, 0x0000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 i += aimutil_put16(newrx->data+i, 0x01);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 i += aimutil_putstr(newrx->data+i, "0", 1);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 newrx->conn = conn;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 newrx->next = sess->queue_incoming;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 sess->queue_incoming = newrx;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 newrx->lock = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96 sess->flags &= ~AIM_SESS_FLAGS_SNACLOGIN;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 return 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 sess->flags |= AIM_SESS_FLAGS_SNACLOGIN;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 aim_sendconnack(sess, conn);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10+2+2+strlen(sn))))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108 newpacket->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110 curbyte = aim_putsnac(newpacket->data, 0x0017, 0x0006, 0x0000, 0x00010000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0001, strlen(sn), sn);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113 newpacket->commandlen = curbyte;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 newpacket->lock = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116 return aim_tx_enqueue(sess, newpacket);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 * send_login(int socket, char *sn, char *password)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122 * This is the initial login request packet.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123 *
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
124 * NOTE!! If you want/need to make use of the aim_sendmemblock() function,
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
125 * then the client information you send here must exactly match the
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
126 * executable that you're pulling the data from.
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 * Latest WinAIM:
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 * clientstring = "AOL Instant Messenger (SM), version 4.3.2188/WIN32"
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 * major2 = 0x0109
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131 * major = 0x0400
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132 * minor = 0x0003
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 * minor2 = 0x0000
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134 * build = 0x088c
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135 * unknown = 0x00000086
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 * lang = "en"
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 * country = "us"
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 * unknown4a = 0x01
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
139 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
140 * Latest WinAIM that libfaim can emulate without server-side buddylists:
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
141 * clientstring = "AOL Instant Messenger (SM), version 4.1.2010/WIN32"
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
142 * major2 = 0x0004
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
143 * major = 0x0004
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
144 * minor = 0x0001
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
145 * minor2 = 0x0000
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
146 * build = 0x07da
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
147 * unknown= 0x0000004b
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
148 *
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
149 * WinAIM 3.5.1670:
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
150 * clientstring = "AOL Instant Messenger (SM), version 3.5.1670/WIN32"
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
151 * major2 = 0x0004
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
152 * major = 0x0003
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
153 * minor = 0x0005
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
154 * minor2 = 0x0000
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
155 * build = 0x0686
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
156 * unknown =0x0000002a
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
157 *
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
158 * Java AIM 1.1.19:
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
159 * clientstring = "AOL Instant Messenger (TM) version 1.1.19 for Java built 03/24/98, freeMem 215871 totalMem 1048567, i686, Linus, #2 SMP Sun Feb 11 03:41:17 UTC 2001 2.4.1-ac9, IBM Corporation, 1.1.8, 45.3, Tue Mar 27 12:09:17 PST 2001"
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
160 * major2 = 0x0001
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
161 * major = 0x0001
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
162 * minor = 0x0001
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
163 * minor2 = (not sent)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
164 * build = 0x0013
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
165 * unknown= (not sent)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
166 *
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
167 * AIM for Linux 1.1.112:
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
168 * clientstring = "AOL Instant Messenger (SM)"
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
169 * major2 = 0x1d09
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
170 * major = 0x0001
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
171 * minor = 0x0001
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
172 * minor2 = 0x0001
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
173 * build = 0x0070
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
174 * unknown= 0x0000008b
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
175 * serverstore = 0x01
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
176 *
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 faim_export int aim_send_login (struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 struct aim_conn_t *conn,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180 char *sn, char *password,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 struct client_info_s *clientinfo,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 char *key)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 int curbyte=0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185 struct command_tx_struct *newpacket;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 if (!clientinfo || !sn || !password)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 1152)))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 newpacket->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 newpacket->hdr.oscar.type = (sess->flags & AIM_SESS_FLAGS_SNACLOGIN)?0x02:0x01;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197 if (sess->flags & AIM_SESS_FLAGS_SNACLOGIN)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 curbyte = aim_putsnac(newpacket->data, 0x0017, 0x0002, 0x0000, 0x00010000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199 else {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 curbyte = aimutil_put16(newpacket->data, 0x0000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0001, strlen(sn), sn);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 if (sess->flags & AIM_SESS_FLAGS_SNACLOGIN) {
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
207 unsigned char digest[16];
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 aim_encode_password_md5(password, key, digest);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 curbyte+= aim_puttlv_str(newpacket->data+curbyte, 0x0025, 16, (char *)digest);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 } else {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 char *password_encoded;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 password_encoded = (char *) malloc(strlen(password));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 aim_encode_password(password, password_encoded);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0002, strlen(password), password_encoded);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217 free(password_encoded);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
220 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0003, strlen(clientinfo->clientstring), clientinfo->clientstring);
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222 if (sess->flags & AIM_SESS_FLAGS_SNACLOGIN) {
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
223
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, (unsigned short)clientinfo->major2);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, (unsigned short)clientinfo->major);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, (unsigned short)clientinfo->minor);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, (unsigned short)clientinfo->minor2);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, (unsigned short)clientinfo->build);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
229
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 } else {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 /* Use very specific version numbers, to further indicate the hack. */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, 0x010a);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
233 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, 0x0004);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, 0x003c);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, 0x0001);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, 0x0cce);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237 curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, 0x00000055);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
239
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
240 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000e, strlen(clientinfo->country), clientinfo->country);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
241 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000f, strlen(clientinfo->lang), clientinfo->lang);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
242
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
243 if (sess->flags & AIM_SESS_FLAGS_SNACLOGIN) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
244 curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, clientinfo->unknown);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
245 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0009, 0x0015);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
246 }
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 newpacket->commandlen = curbyte;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 newpacket->lock = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 return aim_tx_enqueue(sess, newpacket);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
254 faim_export int aim_encode_password_md5(const char *password, const char *key, unsigned char *digest)
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 md5_state_t state;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 md5_init(&state);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 md5_append(&state, (const md5_byte_t *)key, strlen(key));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 md5_append(&state, (const md5_byte_t *)password, strlen(password));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 md5_finish(&state, (md5_byte_t *)digest);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 return 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 /**
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 * aim_encode_password - Encode a password using old XOR method
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 * @password: incoming password
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 * @encoded: buffer to put encoded password
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 * This takes a const pointer to a (null terminated) string
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 * containing the unencoded password. It also gets passed
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 * an already allocated buffer to store the encoded password.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275 * This buffer should be the exact length of the password without
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 * the null. The encoded password buffer /is not %NULL terminated/.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 * The encoding_table seems to be a fixed set of values. We'll
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 * hope it doesn't change over time!
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 * This is only used for the XOR method, not the better MD5 method.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 static int aim_encode_password(const char *password, unsigned char *encoded)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286 u_char encoding_table[] = {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 #if 0 /* old v1 table */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 0xf3, 0xb3, 0x6c, 0x99,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 0x95, 0x3f, 0xac, 0xb6,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 0xc5, 0xfa, 0x6b, 0x63,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291 0x69, 0x6c, 0xc3, 0x9f
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 #else /* v2.1 table, also works for ICQ */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 0xf3, 0x26, 0x81, 0xc4,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 0x39, 0x86, 0xdb, 0x92,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 0x71, 0xa3, 0xb9, 0xe6,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296 0x53, 0x7a, 0x95, 0x7c
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297 #endif
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 };
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300 int i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
302 for (i = 0; i < strlen(password); i++)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 encoded[i] = (password[i] ^ encoding_table[i]);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305 return 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
308 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309 * Generate an authorization response.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
311 * You probably don't want this unless you're writing an AIM server.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 struct aim_conn_t *conn,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 char *sn, int errorcode,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 char *errorurl, char *bosip,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318 char *cookie, char *email,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319 int regstatus)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 struct command_tx_struct *tx;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322 struct aim_tlvlist_t *tlvlist = NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0004, 1152)))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
326
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327 tx->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
329 if (sn)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 aim_addtlvtochain_str(&tlvlist, 0x0001, sn, strlen(sn));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 else
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332 aim_addtlvtochain_str(&tlvlist, 0x0001, sess->sn, strlen(sess->sn));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
334 if (errorcode) {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 aim_addtlvtochain16(&tlvlist, 0x0008, errorcode);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336 aim_addtlvtochain_str(&tlvlist, 0x0004, errorurl, strlen(errorurl));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337 } else {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338 aim_addtlvtochain_str(&tlvlist, 0x0005, bosip, strlen(bosip));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 aim_addtlvtochain_str(&tlvlist, 0x0006, cookie, AIM_COOKIELEN);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340 aim_addtlvtochain_str(&tlvlist, 0x0011, email, strlen(email));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 aim_addtlvtochain16(&tlvlist, 0x0013, (unsigned short)regstatus);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 tx->commandlen = aim_writetlvchain(tx->data, tx->commandlen, &tlvlist);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345 tx->lock = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347 return aim_tx_enqueue(sess, tx);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
348 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
349
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
350 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351 * Generate a random cookie. (Non-client use only)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353 faim_export int aim_gencookie(unsigned char *buf)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355 int i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 srand(time(NULL));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 for (i=0; i < AIM_COOKIELEN; i++)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 buf[i] = 1+(int) (256.0*rand()/(RAND_MAX+0.0));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 return i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 * Send Server Ready. (Non-client)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 faim_export int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370 struct command_tx_struct *tx;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371 int i = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10+0x22)))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 tx->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378 i += aim_putsnac(tx->data, 0x0001, 0x0003, 0x0000, sess->snac_nextid++);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 i += aimutil_put16(tx->data+i, 0x0001);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381 i += aimutil_put16(tx->data+i, 0x0002);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 i += aimutil_put16(tx->data+i, 0x0003);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 i += aimutil_put16(tx->data+i, 0x0004);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384 i += aimutil_put16(tx->data+i, 0x0006);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385 i += aimutil_put16(tx->data+i, 0x0008);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 i += aimutil_put16(tx->data+i, 0x0009);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387 i += aimutil_put16(tx->data+i, 0x000a);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388 i += aimutil_put16(tx->data+i, 0x000b);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
389 i += aimutil_put16(tx->data+i, 0x000c);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
390 i += aimutil_put16(tx->data+i, 0x0013);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391 i += aimutil_put16(tx->data+i, 0x0015);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393 tx->commandlen = i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 tx->lock = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
395 return aim_tx_enqueue(sess, tx);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
397
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
398
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400 * Send service redirect. (Non-Client)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402 faim_export unsigned long aim_sendredirect(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
403 struct aim_conn_t *conn,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
404 unsigned short servid,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
405 char *ip,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
406 char *cookie)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
408 struct command_tx_struct *tx;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
409 struct aim_tlvlist_t *tlvlist = NULL;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
410 int i = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
411
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
412 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 1152)))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
414
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415 tx->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417 i += aim_putsnac(tx->data+i, 0x0001, 0x0005, 0x0000, 0x00000000);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
419 aim_addtlvtochain16(&tlvlist, 0x000d, servid);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420 aim_addtlvtochain_str(&tlvlist, 0x0005, ip, strlen(ip));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421 aim_addtlvtochain_str(&tlvlist, 0x0006, cookie, AIM_COOKIELEN);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
423 tx->commandlen = aim_writetlvchain(tx->data+i, tx->commandlen-i, &tlvlist)+i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
424 aim_freetlvchain(&tlvlist);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
425
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
426 tx->lock = 0;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
427 return aim_tx_enqueue(sess, tx);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428 }
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
429
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
430
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
431 static int hostonline(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
432 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
433 rxcallback_t userfunc;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
434 int ret = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
435 unsigned short *families;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
436 int famcount, i;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
437
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
438 famcount = datalen/2;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
439
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
440 if (!(families = malloc(datalen)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
441 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
442
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
443 for (i = 0; i < famcount; i++)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
444 families[i] = aimutil_get16(data+(i*2));
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
445
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
446 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
447 ret = userfunc(sess, rx, famcount, families);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
448
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
449 free(families);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
450
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
451 return ret;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
452 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
453
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
454 static int redirect(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
455 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
456 int serviceid;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
457 unsigned char *cookie;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
458 char *ip;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
459 rxcallback_t userfunc;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
460 struct aim_tlvlist_t *tlvlist;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
461 char *chathack = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
462 int chathackex = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
463 int ret = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
464
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
465 tlvlist = aim_readtlvchain(data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
466
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
467 if (!aim_gettlv(tlvlist, 0x000d, 1) ||
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
468 !aim_gettlv(tlvlist, 0x0005, 1) ||
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
469 !aim_gettlv(tlvlist, 0x0006, 1)) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
470 aim_freetlvchain(&tlvlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
471 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
472 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
473
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
474 serviceid = aim_gettlv16(tlvlist, 0x000d, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
475 ip = aim_gettlv_str(tlvlist, 0x0005, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
476 cookie = aim_gettlv_str(tlvlist, 0x0006, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
477
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
478 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
479 * Chat hack.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
480 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
481 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
482 if ((serviceid == AIM_CONN_TYPE_CHAT) && sess->pendingjoin) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
483 chathack = sess->pendingjoin;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
484 chathackex = sess->pendingjoinexchange;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
485 sess->pendingjoin = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
486 sess->pendingjoinexchange = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
487 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
488
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
489 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
490 ret = userfunc(sess, rx, serviceid, ip, cookie, chathack, chathackex);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
491
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
492 free(ip);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
493 free(cookie);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
494 free(chathack);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
495
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
496 aim_freetlvchain(&tlvlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
497
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
498 return ret;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
499 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
500
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
501 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
502 * The Rate Limiting System, An Abridged Guide to Nonsense.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
503 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
504 * OSCAR defines several 'rate classes'. Each class has seperate
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
505 * rate limiting properties (limit level, alert level, disconnect
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
506 * level, etc), and a set of SNAC family/type pairs associated with
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
507 * it. The rate classes, their limiting properties, and the definitions
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
508 * of which SNACs are belong to which class, are defined in the
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
509 * Rate Response packet at login to each host.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
510 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
511 * Logically, all rate offenses within one class count against further
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
512 * offenses for other SNACs in the same class (ie, sending messages
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
513 * too fast will limit the number of user info requests you can send,
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
514 * since those two SNACs are in the same rate class).
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
515 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
516 * Since the rate classes are defined dynamically at login, the values
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
517 * below may change. But they seem to be fairly constant.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
518 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
519 * Currently, BOS defines five rate classes, with the commonly used
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
520 * members as follows...
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
521 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
522 * Rate class 0x0001:
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
523 * - Everything thats not in any of the other classes
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
524 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
525 * Rate class 0x0002:
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
526 * - Buddy list add/remove
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
527 * - Permit list add/remove
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
528 * - Deny list add/remove
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
529 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
530 * Rate class 0x0003:
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
531 * - User information requests
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
532 * - Outgoing ICBMs
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
533 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
534 * Rate class 0x0004:
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
535 * - A few unknowns: 2/9, 2/b, and f/2
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
536 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
537 * Rate class 0x0005:
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
538 * - Chat room create
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
539 * - Outgoing chat ICBMs
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
540 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
541 * The only other thing of note is that class 5 (chat) has slightly looser
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
542 * limiting properties than class 3 (normal messages). But thats just a
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
543 * small bit of trivia for you.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
544 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
545 * The last thing that needs to be learned about the rate limiting
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
546 * system is how the actual numbers relate to the passing of time. This
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
547 * seems to be a big mystery.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
548 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
549 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
550
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
551 /* XXX parse this */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
552 static int rateresp(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
553 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
554 rxcallback_t userfunc;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
555
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
556 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
557 return userfunc(sess, rx);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
558
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
559 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
560 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
561
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
562 static int ratechange(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
563 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
564 rxcallback_t userfunc;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
565 int i = 0, code;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
566 unsigned long currentavg, maxavg;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
567 unsigned long rateclass, windowsize, clear, alert, limit, disconnect;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
568
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
569 code = aimutil_get16(data+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
570 i += 2;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
571
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
572 rateclass = aimutil_get16(data+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
573 i += 2;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
574
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
575 windowsize = aimutil_get32(data+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
576 i += 4;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
577 clear = aimutil_get32(data+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
578 i += 4;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
579 alert = aimutil_get32(data+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
580 i += 4;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
581 limit = aimutil_get32(data+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
582 i += 4;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
583 disconnect = aimutil_get32(data+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
584 i += 4;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
585 currentavg = aimutil_get32(data+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
586 i += 4;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
587 maxavg = aimutil_get32(data+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
588 i += 4;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
589
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
590 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
591 return userfunc(sess, rx, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg, maxavg);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
592
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
593 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
594 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
595
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
596 /* XXX parse this */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
597 static int selfinfo(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
598 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
599 rxcallback_t userfunc;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
600
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
601 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
602 return userfunc(sess, rx);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
603
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
604 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
605 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
606
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
607 static int evilnotify(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
608 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
609 rxcallback_t userfunc = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
610 int i = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
611 unsigned short newevil;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
612 struct aim_userinfo_s userinfo;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
613
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
614 newevil = aimutil_get16(data);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
615 i += 2;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
616
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
617 memset(&userinfo, 0, sizeof(struct aim_userinfo_s));
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
618
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
619 if (datalen-i)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
620 i += aim_extractuserinfo(sess, data+i, &userinfo);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
621
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
622 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
623 return userfunc(sess, rx, newevil, &userinfo);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
624
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
625 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
626 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
627
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
628 static int motd(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
629 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
630 rxcallback_t userfunc;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
631 char *msg = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
632 int ret = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
633 struct aim_tlvlist_t *tlvlist;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
634 unsigned short id;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
635
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
636 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
637 * Code.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
638 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
639 * Valid values:
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
640 * 1 Mandatory upgrade
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
641 * 2 Advisory upgrade
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
642 * 3 System bulletin
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
643 * 4 Nothing's wrong ("top o the world" -- normal)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
644 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
645 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
646 id = aimutil_get16(data);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
647
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
648 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
649 * TLVs follow
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
650 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
651 if ((tlvlist = aim_readtlvchain(data+2, datalen-2)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
652 msg = aim_gettlv_str(tlvlist, 0x000b, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
653
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
654 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
655 ret = userfunc(sess, rx, id, msg);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
656
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
657 free(msg);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
658
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
659 aim_freetlvchain(&tlvlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
660
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
661 return ret;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
662 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
663
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
664 static int hostversions(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
665 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
666 rxcallback_t userfunc;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
667 int vercount;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
668
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
669 vercount = datalen/4;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
670
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
671 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
672 return userfunc(sess, rx, vercount, data);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
673
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
674 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
675 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
676
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
677 /*
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
678 * Starting this past week (26 Mar 2001, say), AOL has started sending
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
679 * this nice little extra SNAC. AFAIK, it has never been used until now.
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
680 *
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
681 * The request contains eight bytes. The first four are an offset, the
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
682 * second four are a length.
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
683 *
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
684 * The offset is an offset into aim.exe when it is mapped during execution
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
685 * on Win32. So far, AOL has only been requesting bytes in static regions
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
686 * of memory. (I won't put it past them to start requesting data in
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
687 * less static regions -- regions that are initialized at run time, but still
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
688 * before the client recieves this request.)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
689 *
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
690 * When the client recieves the request, it adds it to the current ds
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
691 * (0x00400000) and dereferences it, copying the data into a buffer which
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
692 * it then runs directly through the MD5 hasher. The 16 byte output of
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
693 * the hash is then sent back to the server.
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
694 *
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
695 * If the client does not send any data back, or the data does not match
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
696 * the data that the specific client should have, the client will get the
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
697 * following message from "AOL Instant Messenger":
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
698 * "You have been disconnected from the AOL Instant Message Service (SM)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
699 * for accessing the AOL network using unauthorized software. You can
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
700 * download a FREE, fully featured, and authorized client, here
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
701 * http://www.aol.com/aim/download2.html"
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
702 * The connection is then closed, recieving disconnect code 1, URL
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
703 * http://www.aim.aol.com/errors/USER_LOGGED_OFF_NEW_LOGIN.html.
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
704 *
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
705 * Note, however, that numerous inconsistencies can cause the above error,
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
706 * not just sending back a bad hash. Do not immediatly suspect this code
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
707 * if you get disconnected. AOL and the open/free software community have
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
708 * played this game for a couple years now, generating the above message
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
709 * on numerous ocassions.
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
710 *
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
711 * Anyway, neener. We win again.
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
712 *
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
713 */
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
714 static int memrequest(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
715 {
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
716 rxcallback_t userfunc;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
717 unsigned long offset, len;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
718 int i = 0;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
719 struct aim_tlvlist_t *list;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
720 char *modname = NULL;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
721
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
722 offset = aimutil_get32(data);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
723 i += 4;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
724
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
725 len = aimutil_get32(data+4);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
726 i += 4;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
727
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
728 list = aim_readtlvchain(data+i, datalen-i);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
729
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
730 if (aim_gettlv(list, 0x0001, 1))
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
731 modname = aim_gettlv_str(list, 0x0001, 1);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
732
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
733 faimdprintf(sess, 1, "data at 0x%08lx (%d bytes) of requested\n", offset, len, modname?modname:"aim.exe");
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
734
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
735 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
736 return userfunc(sess, rx, offset, len, modname);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
737
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
738 free(modname);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
739 aim_freetlvchain(&list);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
740
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
741 return 0;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
742 }
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
743
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
744 static void dumpbox(struct aim_session_t *sess, unsigned char *buf, int len)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
745 {
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
746 int i = 0;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
747
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
748 if (!sess || !buf || !len)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
749 return;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
750
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
751 faimdprintf(sess, 1, "\nDump of %d bytes at %p:", len, buf);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
752
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
753 for (i = 0; i < len; i++)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
754 {
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
755 if ((i % 8) == 0)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
756 faimdprintf(sess, 1, "\n\t");
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
757
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
758 faimdprintf(sess, 1, "0x%2x ", buf[i]);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
759 }
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
760
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
761 faimdprintf(sess, 1, "\n\n");
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
762
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
763 return;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
764 }
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
765
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
766 faim_export int aim_sendmemblock(struct aim_session_t *sess, struct aim_conn_t *conn, unsigned long offset, unsigned long len, const unsigned char *buf, unsigned char flag)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
767 {
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
768 struct command_tx_struct *tx;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
769 int i = 0;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
770
1750
d2eca7a46cfd [gaim-migrate @ 1760]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1746
diff changeset
771 if (!sess || !conn)
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
772 return 0;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
773
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
774 if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10+2+16)))
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
775 return -1;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
776
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
777 tx->lock = 1;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
778
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
779 i = aim_putsnac(tx->data, 0x0001, 0x0020, 0x0000, sess->snac_nextid++);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
780 i += aimutil_put16(tx->data+i, 0x0010); /* md5 is always 16 bytes */
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
781
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
782 if ((flag == AIM_SENDMEMBLOCK_FLAG_ISHASH) &&
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
783 buf && (len == 0x10)) { /* we're getting a hash */
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
784
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
785 memcpy(tx->data+i, buf, 0x10);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
786 i += 0x10;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
787
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
788 } else if (buf && (len > 0)) { /* use input buffer */
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
789 md5_state_t state;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
790
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
791 md5_init(&state);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
792 md5_append(&state, (const md5_byte_t *)buf, len);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
793 md5_finish(&state, (md5_byte_t *)(tx->data+i));
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
794 i += 0x10;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
795
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
796 } else if (len == 0) { /* no length, just hash NULL (buf is optional) */
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
797 md5_state_t state;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
798 unsigned char nil = '\0';
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
799
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
800 /*
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
801 * These MD5 routines are stupid in that you have to have
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
802 * at least one append. So thats why this doesn't look
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
803 * real logical.
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
804 */
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
805 md5_init(&state);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
806 md5_append(&state, (const md5_byte_t *)&nil, 0);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
807 md5_finish(&state, (md5_byte_t *)(tx->data+i));
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
808 i += 0x10;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
809
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
810 } else {
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
811
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
812 if ((offset != 0x00001004) || (len != 0x00000004))
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
813 faimdprintf(sess, 0, "sendmemblock: WARNING: sending bad hash... you will be disconnected soon...\n");
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
814
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
815 /*
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1750
diff changeset
816 * This data is correct for AIM 3.5.1670, offset 0x1000, length 0
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
817 *
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
818 * Using this block is as close to "legal" as you can get without
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
819 * using an AIM binary.
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1750
diff changeset
820 *
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1750
diff changeset
821 * For the moment, this is the MD5 hash of nothing. Yes, that's
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1750
diff changeset
822 * right. Nothing. AOL is smart.
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1750
diff changeset
823 *
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
824 */
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1750
diff changeset
825 i += aimutil_put32(tx->data+i, 0xd41d8cd9);
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1750
diff changeset
826 i += aimutil_put32(tx->data+i, 0x8f00b204);
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1750
diff changeset
827 i += aimutil_put32(tx->data+i, 0xe9800998);
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1750
diff changeset
828 i += aimutil_put32(tx->data+i, 0xecf8427e);
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
829
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
830 }
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
831
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
832 tx->commandlen = i;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
833 tx->lock = 0;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
834 aim_tx_enqueue(sess, tx);
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
835
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
836 return 0;
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
837 }
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
838
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
839 static int snachandler(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
840 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
841
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
842 if (snac->subtype == 0x0003)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
843 return hostonline(sess, mod, rx, snac, data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
844 else if (snac->subtype == 0x0005)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
845 return redirect(sess, mod, rx, snac, data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
846 else if (snac->subtype == 0x0007)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
847 return rateresp(sess, mod, rx, snac, data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
848 else if (snac->subtype == 0x000a)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
849 return ratechange(sess, mod, rx, snac, data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
850 else if (snac->subtype == 0x000f)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
851 return selfinfo(sess, mod, rx, snac, data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
852 else if (snac->subtype == 0x0010)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
853 return evilnotify(sess, mod, rx, snac, data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
854 else if (snac->subtype == 0x0013)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
855 return motd(sess, mod, rx, snac, data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
856 else if (snac->subtype == 0x0018)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
857 return hostversions(sess, mod, rx, snac, data, datalen);
1746
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
858 else if (snac->subtype == 0x001f)
bacb77b0eb06 [gaim-migrate @ 1756]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1649
diff changeset
859 return memrequest(sess, mod, rx, snac, data, datalen);
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
860
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
861 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
862 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
863
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
864 faim_internal int general_modfirst(struct aim_session_t *sess, aim_module_t *mod)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
865 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
866
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
867 mod->family = 0x0001;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
868 mod->version = 0x0000;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
869 mod->flags = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
870 strncpy(mod->name, "general", sizeof(mod->name));
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
871 mod->snachandler = snachandler;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
872
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
873 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
874 }