Mercurial > pidgin
annotate src/protocols/oscar/auth.c @ 3912:e73c48cf1645
[gaim-migrate @ 4071]
Little touchups in the "admin" family. Not much has changed, but I
moved some functions around because I'm weird. (This is the stuff in
"protocol actions" for oscar accounts.)
Some of the dialogs should look a little more, I dunno, uniform or
something.
Change password, format screenname, and change current registered screen
name should give you some slightly userfriendly error messages now.
Also "confirm account" will pop up that little message that says you
should be expecting an email... I think that was one of those brain
mistakes, where something was backwards, or something.
Uh, so let me know if you see any problems with any of that.
Why did I work on this instead of ssi? I don't know. This is funner, I
guess. I'll get to ssi eventually...
Meow.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 07 Nov 2002 02:25:12 +0000 |
parents | 66b1ad9782a9 |
children | 6efe00ee7de8 |
rev | line source |
---|---|
2086 | 1 /* |
3912 | 2 * Family 0x0017 - Authentication. |
3 * | |
4 * Deals with the authorizer for SNAC-based login, and also old-style | |
5 * non-SNAC login. | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
6 * |
2086 | 7 */ |
8 | |
9 #define FAIM_INTERNAL | |
10 #include <aim.h> | |
11 | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
12 #include "md5.h" |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
13 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
14 static int aim_encode_password(const char *password, unsigned char *encoded); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
15 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
16 /* |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
17 * This just pushes the passed cookie onto the passed connection, without |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
18 * the SNAC header or any of that. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
19 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
20 * Very commonly used, as every connection except auth will require this to |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
21 * be the first thing you send. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
22 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
23 */ |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
24 faim_export int aim_sendcookie(aim_session_t *sess, aim_conn_t *conn, const fu8_t *chipsahoy) |
2086 | 25 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
26 aim_frame_t *fr; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
27 aim_tlvlist_t *tl = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
28 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
29 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x0001, 4+2+2+AIM_COOKIELEN))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
30 return -ENOMEM; |
2086 | 31 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
32 aimbs_put32(&fr->data, 0x00000001); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
33 aim_addtlvtochain_raw(&tl, 0x0006, AIM_COOKIELEN, chipsahoy); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
34 aim_writetlvchain(&fr->data, &tl); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
35 aim_freetlvchain(&tl); |
2086 | 36 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
37 aim_tx_enqueue(sess, fr); |
2086 | 38 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
39 return 0; |
2086 | 40 } |
41 | |
42 /* | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
43 * Normally the FLAP version is sent as the first few bytes of the cookie, |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
44 * meaning you generally never call this. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
45 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
46 * But there are times when something might want it seperate. Specifically, |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
47 * libfaim sends this internally when doing SNAC login. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
48 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
49 */ |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
50 faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
51 { |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
52 aim_frame_t *fr; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
53 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
54 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4))) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
55 return -ENOMEM; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
56 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
57 aimbs_put32(&fr->data, 0x00000001); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
58 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
59 aim_tx_enqueue(sess, fr); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
60 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
61 return 0; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
62 } |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
63 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
64 /* |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
65 * This is a bit confusing. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
66 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
67 * Normal SNAC login goes like this: |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
68 * - connect |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
69 * - server sends flap version |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
70 * - client sends flap version |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
71 * - client sends screen name (17/6) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
72 * - server sends hash key (17/7) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
73 * - client sends auth request (17/2 -- aim_send_login) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
74 * - server yells |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
75 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
76 * XOR login (for ICQ) goes like this: |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
77 * - connect |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
78 * - server sends flap version |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
79 * - client sends auth request which contains flap version (aim_send_login) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
80 * - server yells |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
81 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
82 * For the client API, we make them implement the most complicated version, |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
83 * and for the simpler version, we fake it and make it look like the more |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
84 * complicated process. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
85 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
86 * This is done by giving the client a faked key, just so we can convince |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
87 * them to call aim_send_login right away, which will detect the session |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
88 * flag that says this is XOR login and ignore the key, sending an ICQ |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
89 * login request instead of the normal SNAC one. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
90 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
91 * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
92 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
93 * XXX This may cause problems if the client relies on callbacks only |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
94 * being called from the context of aim_rxdispatch()... |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
95 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
96 */ |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
97 static int goddamnicq(aim_session_t *sess, aim_conn_t *conn, const char *sn) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
98 { |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
99 aim_frame_t fr; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
100 aim_rxcallback_t userfunc; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
101 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
102 sess->flags &= ~AIM_SESS_FLAGS_SNACLOGIN; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
103 sess->flags |= AIM_SESS_FLAGS_XORLOGIN; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
104 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
105 fr.conn = conn; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
106 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
107 if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007))) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
108 userfunc(sess, &fr, ""); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
109 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
110 return 0; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
111 } |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
112 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
113 /* |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
114 * In AIM 3.5 protocol, the first stage of login is to request login from the |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
115 * Authorizer, passing it the screen name for verification. If the name is |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
116 * invalid, a 0017/0003 is spit back, with the standard error contents. If |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
117 * valid, a 0017/0007 comes back, which is the signal to send it the main |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
118 * login command (0017/0002). |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
119 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
120 */ |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
121 faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
122 { |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
123 aim_frame_t *fr; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
124 aim_snacid_t snacid; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
125 aim_tlvlist_t *tl = NULL; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
126 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
127 if (!sess || !conn || !sn) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
128 return -EINVAL; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
129 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
130 if ((sn[0] >= '0') && (sn[0] <= '9')) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
131 return goddamnicq(sess, conn, sn); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
132 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
133 sess->flags |= AIM_SESS_FLAGS_SNACLOGIN; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
134 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
135 aim_sendflapver(sess, conn); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
136 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
137 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(sn)))) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
138 return -ENOMEM; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
139 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
140 snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
141 aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
142 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
143 aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
144 aim_writetlvchain(&fr->data, &tl); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
145 aim_freetlvchain(&tl); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
146 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
147 aim_tx_enqueue(sess, fr); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
148 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
149 return 0; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
150 } |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
151 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
152 /* |
3458 | 153 * Part two of the ICQ hack. Note the ignoring of the key. |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
154 */ |
3458 | 155 static int goddamnicq2(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password, struct client_info_s *ci) |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
156 { |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
157 aim_frame_t *fr; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
158 aim_tlvlist_t *tl = NULL; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
159 char *password_encoded; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
160 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
161 if (!(password_encoded = (char *) malloc(strlen(password)))) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
162 return -ENOMEM; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
163 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
164 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 1152))) { |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
165 free(password_encoded); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
166 return -ENOMEM; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
167 } |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
168 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
169 aim_encode_password(password, password_encoded); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
170 |
3458 | 171 aimbs_put32(&fr->data, 0x00000001); /* FLAP Version */ |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
172 aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
173 aim_addtlvtochain_raw(&tl, 0x0002, strlen(password), password_encoded); |
3458 | 174 |
175 if (ci->clientstring) | |
176 aim_addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); | |
177 aim_addtlvtochain16(&tl, 0x0016, (fu16_t)ci->clientid); | |
178 aim_addtlvtochain16(&tl, 0x0017, (fu16_t)ci->major); | |
179 aim_addtlvtochain16(&tl, 0x0018, (fu16_t)ci->minor); | |
180 aim_addtlvtochain16(&tl, 0x0019, (fu16_t)ci->point); | |
181 aim_addtlvtochain16(&tl, 0x001a, (fu16_t)ci->build); | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
182 aim_addtlvtochain32(&tl, 0x0014, 0x00000055); /* distribution chan */ |
3458 | 183 aim_addtlvtochain_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); |
184 aim_addtlvtochain_raw(&tl, 0x000e, strlen(ci->country), ci->country); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
185 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
186 aim_writetlvchain(&fr->data, &tl); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
187 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
188 free(password_encoded); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
189 aim_freetlvchain(&tl); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
190 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
191 aim_tx_enqueue(sess, fr); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
192 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
193 return 0; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
194 } |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
195 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
196 /* |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
197 * send_login(int socket, char *sn, char *password) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
198 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
199 * This is the initial login request packet. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
200 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
201 * NOTE!! If you want/need to make use of the aim_sendmemblock() function, |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
202 * then the client information you send here must exactly match the |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
203 * executable that you're pulling the data from. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
204 * |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
205 * WinAIM 4.8.2540 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
206 * clientstring = "AOL Instant Messenger (SM), version 4.8.2540/WIN32" |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
207 * clientid = 0x0109 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
208 * major = 0x0004 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
209 * minor = 0x0008 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
210 * point = 0x0000 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
211 * build = 0x09ec |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
212 * t(0x0014) = 0x000000af |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
213 * t(0x004a) = 0x01 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
214 * |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
215 * WinAIM 4.3.2188: |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
216 * clientstring = "AOL Instant Messenger (SM), version 4.3.2188/WIN32" |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
217 * clientid = 0x0109 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
218 * major = 0x0400 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
219 * minor = 0x0003 |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
220 * point = 0x0000 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
221 * build = 0x088c |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
222 * unknown = 0x00000086 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
223 * lang = "en" |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
224 * country = "us" |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
225 * unknown4a = 0x01 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
226 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
227 * Latest WinAIM that libfaim can emulate without server-side buddylists: |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
228 * clientstring = "AOL Instant Messenger (SM), version 4.1.2010/WIN32" |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
229 * clientid = 0x0004 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
230 * major = 0x0004 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
231 * minor = 0x0001 |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
232 * point = 0x0000 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
233 * build = 0x07da |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
234 * unknown= 0x0000004b |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
235 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
236 * WinAIM 3.5.1670: |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
237 * clientstring = "AOL Instant Messenger (SM), version 3.5.1670/WIN32" |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
238 * clientid = 0x0004 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
239 * major = 0x0003 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
240 * minor = 0x0005 |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
241 * point = 0x0000 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
242 * build = 0x0686 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
243 * unknown =0x0000002a |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
244 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
245 * Java AIM 1.1.19: |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
246 * 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" |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
247 * clientid = 0x0001 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
248 * major = 0x0001 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
249 * minor = 0x0001 |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
250 * point = (not sent) |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
251 * build = 0x0013 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
252 * unknown= (not sent) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
253 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
254 * AIM for Linux 1.1.112: |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
255 * clientstring = "AOL Instant Messenger (SM)" |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
256 * clientid = 0x1d09 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
257 * major = 0x0001 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
258 * minor = 0x0001 |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
259 * point = 0x0001 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
260 * build = 0x0070 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
261 * unknown= 0x0000008b |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
262 * serverstore = 0x01 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
263 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
264 */ |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
265 faim_export int aim_send_login(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password, struct client_info_s *ci, const char *key) |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
266 { |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
267 aim_frame_t *fr; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
268 aim_tlvlist_t *tl = NULL; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
269 fu8_t digest[16]; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
270 aim_snacid_t snacid; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
271 |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
272 if (!ci || !sn || !password) |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
273 return -EINVAL; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
274 |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
275 /* |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
276 * What the XORLOGIN flag _really_ means is that its an ICQ login, |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
277 * which is really stupid and painful, so its not done here. |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
278 * |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
279 */ |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
280 if (sess->flags & AIM_SESS_FLAGS_XORLOGIN) |
3458 | 281 return goddamnicq2(sess, conn, sn, password, ci); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
282 |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
283 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
284 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
285 return -ENOMEM; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
286 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
287 snacid = aim_cachesnac(sess, 0x0017, 0x0002, 0x0000, NULL, 0); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
288 aim_putsnac(&fr->data, 0x0017, 0x0002, 0x0000, snacid); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
289 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
290 aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
291 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
292 aim_encode_password_md5(password, key, digest); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
293 aim_addtlvtochain_raw(&tl, 0x0025, 16, digest); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
294 |
3213 | 295 /* |
296 * Newer versions of winaim have an empty type x004c TLV here. | |
297 */ | |
298 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
299 if (ci->clientstring) |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
300 aim_addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
301 aim_addtlvtochain16(&tl, 0x0016, (fu16_t)ci->clientid); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
302 aim_addtlvtochain16(&tl, 0x0017, (fu16_t)ci->major); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
303 aim_addtlvtochain16(&tl, 0x0018, (fu16_t)ci->minor); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
304 aim_addtlvtochain16(&tl, 0x0019, (fu16_t)ci->point); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
305 aim_addtlvtochain16(&tl, 0x001a, (fu16_t)ci->build); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
306 aim_addtlvtochain_raw(&tl, 0x000e, strlen(ci->country), ci->country); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
307 aim_addtlvtochain_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
308 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
309 /* |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
310 * If set, old-fashioned buddy lists will not work. You will need |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
311 * to use SSI. |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
312 */ |
3068 | 313 aim_addtlvtochain8(&tl, 0x004a, 0x01); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
314 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
315 aim_writetlvchain(&fr->data, &tl); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
316 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
317 aim_freetlvchain(&tl); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
318 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
319 aim_tx_enqueue(sess, fr); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
320 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
321 return 0; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
322 } |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
323 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
324 faim_export int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
325 { |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
326 md5_state_t state; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
327 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
328 md5_init(&state); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
329 md5_append(&state, (const md5_byte_t *)key, strlen(key)); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
330 md5_append(&state, (const md5_byte_t *)password, strlen(password)); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
331 md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
332 md5_finish(&state, (md5_byte_t *)digest); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
333 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
334 return 0; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
335 } |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
336 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
337 /** |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
338 * aim_encode_password - Encode a password using old XOR method |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
339 * @password: incoming password |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
340 * @encoded: buffer to put encoded password |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
341 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
342 * This takes a const pointer to a (null terminated) string |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
343 * containing the unencoded password. It also gets passed |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
344 * an already allocated buffer to store the encoded password. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
345 * This buffer should be the exact length of the password without |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
346 * the null. The encoded password buffer /is not %NULL terminated/. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
347 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
348 * The encoding_table seems to be a fixed set of values. We'll |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
349 * hope it doesn't change over time! |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
350 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
351 * This is only used for the XOR method, not the better MD5 method. |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
352 * |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
353 */ |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
354 static int aim_encode_password(const char *password, fu8_t *encoded) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
355 { |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
356 fu8_t encoding_table[] = { |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
357 #if 0 /* old v1 table */ |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
358 0xf3, 0xb3, 0x6c, 0x99, |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
359 0x95, 0x3f, 0xac, 0xb6, |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
360 0xc5, 0xfa, 0x6b, 0x63, |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
361 0x69, 0x6c, 0xc3, 0x9f |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
362 #else /* v2.1 table, also works for ICQ */ |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
363 0xf3, 0x26, 0x81, 0xc4, |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
364 0x39, 0x86, 0xdb, 0x92, |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
365 0x71, 0xa3, 0xb9, 0xe6, |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
366 0x53, 0x7a, 0x95, 0x7c |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
367 #endif |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
368 }; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
369 int i; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
370 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
371 for (i = 0; i < strlen(password); i++) |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
372 encoded[i] = (password[i] ^ encoding_table[i]); |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
373 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
374 return 0; |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
375 } |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
376 |
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
377 /* |
2086 | 378 * This is sent back as a general response to the login command. |
379 * It can be either an error or a success, depending on the | |
380 * precense of certain TLVs. | |
381 * | |
382 * The client should check the value passed as errorcode. If | |
383 * its nonzero, there was an error. | |
384 * | |
385 */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
386 static int parse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 387 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
388 aim_tlvlist_t *tlvlist; |
2704 | 389 aim_rxcallback_t userfunc; |
390 struct aim_authresp_info info; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
391 int ret = 0; |
2704 | 392 |
393 memset(&info, 0, sizeof(info)); | |
2086 | 394 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
395 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
396 * Read block of TLVs. All further data is derived |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
397 * from what is parsed here. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
398 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
399 tlvlist = aim_readtlvchain(bs); |
2086 | 400 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
401 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
402 * No matter what, we should have a screen name. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
403 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
404 memset(sess->sn, 0, sizeof(sess->sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
405 if (aim_gettlv(tlvlist, 0x0001, 1)) { |
2704 | 406 info.sn = aim_gettlv_str(tlvlist, 0x0001, 1); |
407 strncpy(sess->sn, info.sn, sizeof(sess->sn)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
408 } |
2086 | 409 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
410 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
411 * Check for an error code. If so, we should also |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
412 * have an error url. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
413 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
414 if (aim_gettlv(tlvlist, 0x0008, 1)) |
2704 | 415 info.errorcode = aim_gettlv16(tlvlist, 0x0008, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
416 if (aim_gettlv(tlvlist, 0x0004, 1)) |
2704 | 417 info.errorurl = aim_gettlv_str(tlvlist, 0x0004, 1); |
2086 | 418 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
419 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
420 * BOS server address. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
421 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
422 if (aim_gettlv(tlvlist, 0x0005, 1)) |
2704 | 423 info.bosip = aim_gettlv_str(tlvlist, 0x0005, 1); |
2086 | 424 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
425 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
426 * Authorization cookie. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
427 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
428 if (aim_gettlv(tlvlist, 0x0006, 1)) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
429 aim_tlv_t *tmptlv; |
2086 | 430 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
431 tmptlv = aim_gettlv(tlvlist, 0x0006, 1); |
2086 | 432 |
2704 | 433 info.cookie = tmptlv->value; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
434 } |
2086 | 435 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
436 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
437 * The email address attached to this account |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
438 * Not available for ICQ logins. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
439 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
440 if (aim_gettlv(tlvlist, 0x0011, 1)) |
2704 | 441 info.email = aim_gettlv_str(tlvlist, 0x0011, 1); |
2086 | 442 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
443 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
444 * The registration status. (Not real sure what it means.) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
445 * Not available for ICQ logins. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
446 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
447 * 1 = No disclosure |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
448 * 2 = Limited disclosure |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
449 * 3 = Full disclosure |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
450 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
451 * This has to do with whether your email address is available |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
452 * to other users or not. AFAIK, this feature is no longer used. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
453 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
454 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
455 if (aim_gettlv(tlvlist, 0x0013, 1)) |
2704 | 456 info.regstatus = aim_gettlv16(tlvlist, 0x0013, 1); |
2086 | 457 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
458 if (aim_gettlv(tlvlist, 0x0040, 1)) |
2704 | 459 info.latestbeta.build = aim_gettlv32(tlvlist, 0x0040, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
460 if (aim_gettlv(tlvlist, 0x0041, 1)) |
2704 | 461 info.latestbeta.url = aim_gettlv_str(tlvlist, 0x0041, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
462 if (aim_gettlv(tlvlist, 0x0042, 1)) |
2704 | 463 info.latestbeta.info = aim_gettlv_str(tlvlist, 0x0042, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
464 if (aim_gettlv(tlvlist, 0x0043, 1)) |
2704 | 465 info.latestbeta.name = aim_gettlv_str(tlvlist, 0x0043, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
466 if (aim_gettlv(tlvlist, 0x0048, 1)) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
467 ; /* no idea what this is */ |
2086 | 468 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
469 if (aim_gettlv(tlvlist, 0x0044, 1)) |
2704 | 470 info.latestrelease.build = aim_gettlv32(tlvlist, 0x0044, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
471 if (aim_gettlv(tlvlist, 0x0045, 1)) |
2704 | 472 info.latestrelease.url = aim_gettlv_str(tlvlist, 0x0045, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
473 if (aim_gettlv(tlvlist, 0x0046, 1)) |
2704 | 474 info.latestrelease.info = aim_gettlv_str(tlvlist, 0x0046, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
475 if (aim_gettlv(tlvlist, 0x0047, 1)) |
2704 | 476 info.latestrelease.name = aim_gettlv_str(tlvlist, 0x0047, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
477 if (aim_gettlv(tlvlist, 0x0049, 1)) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
478 ; /* no idea what this is */ |
2086 | 479 |
3912 | 480 /* |
481 * URL to change password. | |
482 */ | |
483 if (aim_gettlv(tlvlist, 0x0054, 1)) | |
484 info.chpassurl = aim_gettlv_str(tlvlist, 0x0054, 1); | |
2086 | 485 |
2704 | 486 if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003))) |
487 ret = userfunc(sess, rx, &info); | |
2086 | 488 |
2704 | 489 free(info.sn); |
490 free(info.bosip); | |
491 free(info.errorurl); | |
492 free(info.email); | |
3912 | 493 free(info.chpassurl); |
2704 | 494 free(info.latestrelease.name); |
495 free(info.latestrelease.url); | |
496 free(info.latestrelease.info); | |
497 free(info.latestbeta.name); | |
498 free(info.latestbeta.url); | |
499 free(info.latestbeta.info); | |
2086 | 500 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
501 aim_freetlvchain(&tlvlist); |
2086 | 502 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
503 return ret; |
2086 | 504 } |
505 | |
506 /* | |
507 * Middle handler for 0017/0007 SNACs. Contains the auth key prefixed | |
508 * by only its length in a two byte word. | |
509 * | |
510 * Calls the client, which should then use the value to call aim_send_login. | |
511 * | |
512 */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
513 static int keyparse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 514 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
515 int keylen, ret = 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
516 aim_rxcallback_t userfunc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
517 char *keystr; |
2086 | 518 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
519 keylen = aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
520 keystr = aimbs_getstr(bs, keylen); |
2086 | 521 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
522 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
523 ret = userfunc(sess, rx, keystr); |
2086 | 524 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
525 free(keystr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
526 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
527 return ret; |
2086 | 528 } |
529 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
530 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 531 { |
532 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
533 if (snac->subtype == 0x0003) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
534 return parse(sess, mod, rx, snac, bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
535 else if (snac->subtype == 0x0007) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
536 return keyparse(sess, mod, rx, snac, bs); |
2086 | 537 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
538 return 0; |
2086 | 539 } |
540 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
541 faim_internal int auth_modfirst(aim_session_t *sess, aim_module_t *mod) |
2086 | 542 { |
543 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
544 mod->family = 0x0017; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
545 mod->version = 0x0000; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
546 mod->flags = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
547 strncpy(mod->name, "auth", sizeof(mod->name)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
548 mod->snachandler = snachandler; |
2086 | 549 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
550 return 0; |
2086 | 551 } |