annotate src/protocols/oscar/auth.c @ 11552:11d30825c1bb

[gaim-migrate @ 13812] Source Forge patch 1273590 from Casey Harkins to move all sound playing events into gtksound.[ch] as well as a few other clean ups to make sure that all sounds are being played by the ui. committer: Tailor Script <tailor@pidgin.im>
author Gary Kramlich <grim@reaperworld.com>
date Sat, 17 Sep 2005 03:00:12 +0000
parents 1d29b44038c7
children 8c3a139e8eb3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3458
diff changeset
2 * Family 0x0017 - Authentication.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3458
diff changeset
3 *
11404
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
4 * Deals with the authorizer for SNAC-based login, and also old-style
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3458
diff changeset
5 * non-SNAC login.
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
6 *
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 #define FAIM_INTERNAL
11404
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
10 #include "aim.h"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11
11448
1d29b44038c7 [gaim-migrate @ 13687]
Mark Doliner <mark@kingant.net>
parents: 11404
diff changeset
12 #include "cipher.h"
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
13
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
14 #include <ctype.h>
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
15
10693
f7431a6ff0cb [gaim-migrate @ 12245]
Mark Doliner <mark@kingant.net>
parents: 10644
diff changeset
16 #ifdef USE_XOR_FOR_ICQ
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
17 /**
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
18 * Encode a password using old XOR method
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
19 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
20 * This takes a const pointer to a (null terminated) string
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
21 * containing the unencoded password. It also gets passed
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
22 * an already allocated buffer to store the encoded password.
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
23 * This buffer should be the exact length of the password without
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
24 * the null. The encoded password buffer /is not %NULL terminated/.
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
25 *
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
26 * The encoding_table seems to be a fixed set of values. We'll
11404
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
27 * hope it doesn't change over time!
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
28 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
29 * This is only used for the XOR method, not the better MD5 method.
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
30 *
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
31 * @param password Incoming password.
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
32 * @param encoded Buffer to put encoded password.
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
33 */
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
34 static int aim_encode_password(const char *password, fu8_t *encoded)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 {
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
36 fu8_t encoding_table[] = {
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
37 #if 0 /* old v1 table */
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
38 0xf3, 0xb3, 0x6c, 0x99,
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
39 0x95, 0x3f, 0xac, 0xb6,
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
40 0xc5, 0xfa, 0x6b, 0x63,
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
41 0x69, 0x6c, 0xc3, 0x9f
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
42 #else /* v2.1 table, also works for ICQ */
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
43 0xf3, 0x26, 0x81, 0xc4,
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
44 0x39, 0x86, 0xdb, 0x92,
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
45 0x71, 0xa3, 0xb9, 0xe6,
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
46 0x53, 0x7a, 0x95, 0x7c
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
47 #endif
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
48 };
7631
ea2d07ad05a9 [gaim-migrate @ 8255]
Nathan Walp <nwalp@pidgin.im>
parents: 7313
diff changeset
49 unsigned int i;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
51 for (i = 0; i < strlen(password); i++)
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
52 encoded[i] = (password[i] ^ encoding_table[i]);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
54 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 }
10693
f7431a6ff0cb [gaim-migrate @ 12245]
Mark Doliner <mark@kingant.net>
parents: 10644
diff changeset
56 #endif
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
58 #ifdef USE_OLD_MD5
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
59 static int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest)
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
60 {
11404
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
61 GaimCipher *cipher;
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
62 GaimCipherContext *context;
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
63
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
64 cipher = gaim_ciphers_find_cipher("md5");
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
65
11404
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
66 context = gaim_cipher_context_new(cipher, NULL);
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
67 gaim_cipher_context_append(context, (const guchar *)key, strlen(key));
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
68 gaim_cipher_context_append(context, (const guchar *)password, strlen(password));
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
69 gaim_cipher_context_append(context, (const guchar *)AIM_MD5_STRING, strlen(AIM_MD5_STRING));
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
70 gaim_cipher_context_digest(context, 16, digest, NULL);
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
71 gaim_cipher_context_destroy(context);
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
72
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
73 return 0;
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
74 }
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
75 #else
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
76 static int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest)
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
77 {
11404
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
78 GaimCipher *cipher;
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
79 GaimCipherContext *context;
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
80 guchar passdigest[16];
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
81
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
82 cipher = gaim_ciphers_find_cipher("md5");
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
83
11404
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
84 context = gaim_cipher_context_new(cipher, NULL);
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
85 gaim_cipher_context_append(context, (const guchar *)password, strlen(password));
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
86 gaim_cipher_context_digest(context, 16, passdigest, NULL);
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
87 gaim_cipher_context_destroy(context);
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
88
11404
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
89 context = gaim_cipher_context_new(cipher, NULL);
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
90 gaim_cipher_context_append(context, (const guchar *)key, strlen(key));
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
91 gaim_cipher_context_append(context, passdigest, 16);
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
92 gaim_cipher_context_append(context, (const guchar *)AIM_MD5_STRING, strlen(AIM_MD5_STRING));
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
93 gaim_cipher_context_digest(context, 16, digest, NULL);
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
94 gaim_cipher_context_destroy(context);
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
95
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
96 return 0;
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
97 }
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
98 #endif
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
99
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100 /*
11404
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
101 * The FLAP version is sent by itself at the beginning of authorization
677a3862260f [gaim-migrate @ 13639]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
102 * connections. The FLAP version is also sent before the cookie when connecting
7313
be7c1468c6a7 [gaim-migrate @ 7897]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
103 * for other services (BOS, chatnav, chat, etc.).
2703
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 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
106 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
107 aim_frame_t *fr;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
108
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
109 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
110 return -ENOMEM;
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 aimbs_put32(&fr->data, 0x00000001);
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 aim_tx_enqueue(sess, fr);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
115
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
116 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
117 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
118
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
119 /*
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
120 * This just pushes the passed cookie onto the passed connection, without
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
121 * the SNAC header or any of that.
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
122 *
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
123 * Very commonly used, as every connection except auth will require this to
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
124 * be the first thing you send.
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
125 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
126 */
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
127 faim_export int aim_sendcookie(aim_session_t *sess, aim_conn_t *conn, const fu16_t length, const fu8_t *chipsahoy)
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
128 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
129 aim_frame_t *fr;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
130 aim_tlvlist_t *tl = NULL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
131
10267
9cafe038c95e [gaim-migrate @ 11413]
Mark Doliner <mark@kingant.net>
parents: 7631
diff changeset
132 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4+2+2+length)))
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
133 return -ENOMEM;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
134
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
135 aimbs_put32(&fr->data, 0x00000001);
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
136 aim_tlvlist_add_raw(&tl, 0x0006, length, chipsahoy);
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
137 aim_tlvlist_write(&fr->data, &tl);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
138 aim_tlvlist_free(&tl);
2703
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 aim_tx_enqueue(sess, fr);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
141
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
142 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
143 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
144
10693
f7431a6ff0cb [gaim-migrate @ 12245]
Mark Doliner <mark@kingant.net>
parents: 10644
diff changeset
145 #ifdef USE_XOR_FOR_ICQ
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
146 /*
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
147 * 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
148 */
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
149 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
150 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
151 aim_frame_t *fr;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
152 aim_tlvlist_t *tl = NULL;
5345
bfe98c4d331e [gaim-migrate @ 5721]
Mark Doliner <mark@kingant.net>
parents: 4317
diff changeset
153 int passwdlen;
5927
04dc7fe68889 [gaim-migrate @ 6367]
Mark Doliner <mark@kingant.net>
parents: 5345
diff changeset
154 fu8_t *password_encoded;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
155
5345
bfe98c4d331e [gaim-migrate @ 5721]
Mark Doliner <mark@kingant.net>
parents: 4317
diff changeset
156 passwdlen = strlen(password);
bfe98c4d331e [gaim-migrate @ 5721]
Mark Doliner <mark@kingant.net>
parents: 4317
diff changeset
157 if (!(password_encoded = (char *)malloc(passwdlen+1)))
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
158 return -ENOMEM;
5345
bfe98c4d331e [gaim-migrate @ 5721]
Mark Doliner <mark@kingant.net>
parents: 4317
diff changeset
159 if (passwdlen > MAXICQPASSLEN)
bfe98c4d331e [gaim-migrate @ 5721]
Mark Doliner <mark@kingant.net>
parents: 4317
diff changeset
160 passwdlen = MAXICQPASSLEN;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
161
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
162 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
163 free(password_encoded);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
164 return -ENOMEM;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
165 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
166
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
167 aim_encode_password(password, password_encoded);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
168
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
169 aimbs_put32(&fr->data, 0x00000001); /* FLAP Version */
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
170 aim_tlvlist_add_str(&tl, 0x0001, sn);
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
171 aim_tlvlist_add_raw(&tl, 0x0002, passwdlen, password_encoded);
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
172
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
173 if (ci->clientstring)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
174 aim_tlvlist_add_str(&tl, 0x0003, ci->clientstring);
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
175 aim_tlvlist_add_16(&tl, 0x0016, (fu16_t)ci->clientid);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
176 aim_tlvlist_add_16(&tl, 0x0017, (fu16_t)ci->major);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
177 aim_tlvlist_add_16(&tl, 0x0018, (fu16_t)ci->minor);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
178 aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
179 aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
180 aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib); /* distribution chan */
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
181 aim_tlvlist_add_str(&tl, 0x000f, ci->lang);
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
182 aim_tlvlist_add_str(&tl, 0x000e, ci->country);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
183
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
184 aim_tlvlist_write(&fr->data, &tl);
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 free(password_encoded);
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
187 aim_tlvlist_free(&tl);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
188
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
189 aim_tx_enqueue(sess, fr);
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 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
192 }
10693
f7431a6ff0cb [gaim-migrate @ 12245]
Mark Doliner <mark@kingant.net>
parents: 10644
diff changeset
193 #endif
2703
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 /*
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
196 * Subtype 0x0002
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
197 *
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
198 * This is the initial login request packet.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
199 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
200 * 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
201 * then the client information you send here must exactly match the
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
202 * executable that you're pulling the data from.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
203 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
204 * Java AIM 1.1.19:
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
205 * 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
206 * clientid = 0x0001
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
207 * major = 0x0001
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
208 * minor = 0x0001
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
209 * point = (not sent)
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
210 * build = 0x0013
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
211 * unknown= (not sent)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
212 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
213 * AIM for Linux 1.1.112:
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
214 * clientstring = "AOL Instant Messenger (SM)"
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
215 * clientid = 0x1d09
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
216 * major = 0x0001
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
217 * minor = 0x0001
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
218 * point = 0x0001
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
219 * build = 0x0070
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
220 * unknown= 0x0000008b
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
221 * serverstore = 0x01
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
222 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
223 */
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
224 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
225 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
226 aim_frame_t *fr;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
227 aim_tlvlist_t *tl = NULL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
228 fu8_t digest[16];
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
229 aim_snacid_t snacid;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
230
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
231 if (!ci || !sn || !password)
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
232 return -EINVAL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
233
10693
f7431a6ff0cb [gaim-migrate @ 12245]
Mark Doliner <mark@kingant.net>
parents: 10644
diff changeset
234 #ifdef USE_XOR_FOR_ICQ
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
235 /* If we're signing on an ICQ account then use the older, XOR login method */
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
236 if (isdigit(sn[0]))
3458
66b1ad9782a9 [gaim-migrate @ 3506]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
237 return goddamnicq2(sess, conn, sn, password, ci);
10693
f7431a6ff0cb [gaim-migrate @ 12245]
Mark Doliner <mark@kingant.net>
parents: 10644
diff changeset
238 #endif
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
239
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
240 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
241 return -ENOMEM;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
242
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
243 snacid = aim_cachesnac(sess, 0x0017, 0x0002, 0x0000, NULL, 0);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
244 aim_putsnac(&fr->data, 0x0017, 0x0002, 0x0000, snacid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
245
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
246 aim_tlvlist_add_str(&tl, 0x0001, sn);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
247
10712
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
248 /* Truncate ICQ passwords, if necessary */
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
249 if (isdigit(sn[0]) && (strlen(password) > MAXICQPASSLEN))
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
250 {
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
251 char truncated[MAXICQPASSLEN + 1];
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
252 strncpy(truncated, password, MAXICQPASSLEN);
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
253 truncated[MAXICQPASSLEN] = 0;
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
254 aim_encode_password_md5(truncated, key, digest);
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
255 }
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
256 else
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
257 {
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
258 aim_encode_password_md5(password, key, digest);
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
259 }
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10693
diff changeset
260
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
261 aim_tlvlist_add_raw(&tl, 0x0025, 16, digest);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
262
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
263 #ifndef USE_OLD_MD5
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
264 aim_tlvlist_add_noval(&tl, 0x004c);
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
265 #endif
3213
7ed9fa994055 [gaim-migrate @ 3230]
Sean Egan <seanegan@gmail.com>
parents: 3068
diff changeset
266
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
267 if (ci->clientstring)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
268 aim_tlvlist_add_str(&tl, 0x0003, ci->clientstring);
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
269 aim_tlvlist_add_16(&tl, 0x0016, (fu16_t)ci->clientid);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
270 aim_tlvlist_add_16(&tl, 0x0017, (fu16_t)ci->major);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
271 aim_tlvlist_add_16(&tl, 0x0018, (fu16_t)ci->minor);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
272 aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
273 aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
274 aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib);
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
275 aim_tlvlist_add_str(&tl, 0x000f, ci->lang);
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
276 aim_tlvlist_add_str(&tl, 0x000e, ci->country);
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
277
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 * 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
280 * to use SSI.
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2704
diff changeset
281 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
282 aim_tlvlist_add_8(&tl, 0x004a, 0x01);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
283
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
284 aim_tlvlist_write(&fr->data, &tl);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
285
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
286 aim_tlvlist_free(&tl);
10267
9cafe038c95e [gaim-migrate @ 11413]
Mark Doliner <mark@kingant.net>
parents: 7631
diff changeset
287
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
288 aim_tx_enqueue(sess, fr);
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 return 0;
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
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
293 /*
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 * This is sent back as a general response to the login command.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 * It can be either an error or a success, depending on the
10812
d087e928ffd1 [gaim-migrate @ 12465]
Luke Schierer <lschiere@pidgin.im>
parents: 10712
diff changeset
296 * presence of certain TLVs.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 * The client should check the value passed as errorcode. If
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 * its nonzero, there was an error.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300 */
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
301 static int parse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
302 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
303 aim_tlvlist_t *tlvlist;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
304 aim_rxcallback_t userfunc;
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
305 struct aim_authresp_info *info;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
306 int ret = 0;
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
307
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
308 info = (struct aim_authresp_info *)malloc(sizeof(struct aim_authresp_info));
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
309 memset(info, 0, sizeof(struct aim_authresp_info));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
311 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
312 * Read block of TLVs. All further data is derived
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
313 * from what is parsed here.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
314 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
315 tlvlist = aim_tlvlist_read(bs);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
317 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
318 * No matter what, we should have a screen name.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
319 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
320 memset(sess->sn, 0, sizeof(sess->sn));
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
321 if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) {
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
322 info->sn = aim_tlv_getstr(tlvlist, 0x0001, 1);
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
323 strncpy(sess->sn, info->sn, sizeof(sess->sn));
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
324 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
326 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
327 * Check for an error code. If so, we should also
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
328 * have an error url.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
329 */
10267
9cafe038c95e [gaim-migrate @ 11413]
Mark Doliner <mark@kingant.net>
parents: 7631
diff changeset
330 if (aim_tlv_gettlv(tlvlist, 0x0008, 1))
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
331 info->errorcode = aim_tlv_get16(tlvlist, 0x0008, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
332 if (aim_tlv_gettlv(tlvlist, 0x0004, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
333 info->errorurl = aim_tlv_getstr(tlvlist, 0x0004, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
334
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
335 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
336 * BOS server address.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
337 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
338 if (aim_tlv_gettlv(tlvlist, 0x0005, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
339 info->bosip = aim_tlv_getstr(tlvlist, 0x0005, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
341 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
342 * Authorization cookie.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
343 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
344 if (aim_tlv_gettlv(tlvlist, 0x0006, 1)) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
345 aim_tlv_t *tmptlv;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
347 tmptlv = aim_tlv_gettlv(tlvlist, 0x0006, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
348
4293
79d871c11eb9 [gaim-migrate @ 4546]
Mark Doliner <mark@kingant.net>
parents: 4230
diff changeset
349 info->cookielen = tmptlv->length;
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
350 info->cookie = tmptlv->value;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
351 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
353 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
354 * The email address attached to this account
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
355 * Not available for ICQ or @mac.com logins.
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
356 * If you receive this TLV, then you are allowed to use
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
357 * family 0x0018 to check the status of your email.
4317
7c9f3d0fe8b2 [gaim-migrate @ 4571]
Mark Doliner <mark@kingant.net>
parents: 4293
diff changeset
358 * XXX - Not really true!
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
359 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
360 if (aim_tlv_gettlv(tlvlist, 0x0011, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
361 info->email = aim_tlv_getstr(tlvlist, 0x0011, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
363 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
364 * The registration status. (Not real sure what it means.)
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
365 * Not available for ICQ or @mac.com logins.
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
366 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
367 * 1 = No disclosure
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
368 * 2 = Limited disclosure
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
369 * 3 = Full disclosure
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
370 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
371 * This has to do with whether your email address is available
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
372 * 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
373 *
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
374 * Means you can use the admin family? (0x0007)
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
375 *
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
376 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
377 if (aim_tlv_gettlv(tlvlist, 0x0013, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
378 info->regstatus = aim_tlv_get16(tlvlist, 0x0013, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
380 if (aim_tlv_gettlv(tlvlist, 0x0040, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
381 info->latestbeta.build = aim_tlv_get32(tlvlist, 0x0040, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
382 if (aim_tlv_gettlv(tlvlist, 0x0041, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
383 info->latestbeta.url = aim_tlv_getstr(tlvlist, 0x0041, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
384 if (aim_tlv_gettlv(tlvlist, 0x0042, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
385 info->latestbeta.info = aim_tlv_getstr(tlvlist, 0x0042, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
386 if (aim_tlv_gettlv(tlvlist, 0x0043, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
387 info->latestbeta.name = aim_tlv_getstr(tlvlist, 0x0043, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
388 if (aim_tlv_gettlv(tlvlist, 0x0048, 1))
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
389 ; /* beta serial */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
390
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
391 if (aim_tlv_gettlv(tlvlist, 0x0044, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
392 info->latestrelease.build = aim_tlv_get32(tlvlist, 0x0044, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
393 if (aim_tlv_gettlv(tlvlist, 0x0045, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
394 info->latestrelease.url = aim_tlv_getstr(tlvlist, 0x0045, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
395 if (aim_tlv_gettlv(tlvlist, 0x0046, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
396 info->latestrelease.info = aim_tlv_getstr(tlvlist, 0x0046, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
397 if (aim_tlv_gettlv(tlvlist, 0x0047, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
398 info->latestrelease.name = aim_tlv_getstr(tlvlist, 0x0047, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
399 if (aim_tlv_gettlv(tlvlist, 0x0049, 1))
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
400 ; /* lastest release serial */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401
3912
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3458
diff changeset
402 /*
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3458
diff changeset
403 * URL to change password.
e73c48cf1645 [gaim-migrate @ 4071]
Mark Doliner <mark@kingant.net>
parents: 3458
diff changeset
404 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
405 if (aim_tlv_gettlv(tlvlist, 0x0054, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
406 info->chpassurl = aim_tlv_getstr(tlvlist, 0x0054, 1);
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
407
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
408 /*
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
409 * Unknown. Seen on an @mac.com screen name with value of 0x003f
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
410 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
411 if (aim_tlv_gettlv(tlvlist, 0x0055, 1))
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
412 ;
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
413
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
414 sess->authinfo = info;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415
2704
fee85ed7fc3f [gaim-migrate @ 2717]
Adam Fritzler <mid@auk.cx>
parents: 2703
diff changeset
416 if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003)))
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
417 ret = userfunc(sess, rx, info);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 5927
diff changeset
419 aim_tlvlist_free(&tlvlist);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
421 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
423
10693
f7431a6ff0cb [gaim-migrate @ 12245]
Mark Doliner <mark@kingant.net>
parents: 10644
diff changeset
424 #ifdef USE_XOR_FOR_ICQ
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
425 /*
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
426 * Subtype 0x0007 (kind of) - Send a fake type 0x0007 SNAC to the client
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
427 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
428 * This is a bit confusing.
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
429 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
430 * Normal SNAC login goes like this:
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
431 * - connect
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
432 * - server sends flap version
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
433 * - client sends flap version
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
434 * - client sends screen name (17/6)
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
435 * - server sends hash key (17/7)
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
436 * - client sends auth request (17/2 -- aim_send_login)
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
437 * - server yells
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
438 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
439 * XOR login (for ICQ) goes like this:
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
440 * - connect
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
441 * - server sends flap version
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
442 * - client sends auth request which contains flap version (aim_send_login)
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
443 * - server yells
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
444 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
445 * For the client API, we make them implement the most complicated version,
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
446 * and for the simpler version, we fake it and make it look like the more
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
447 * complicated process.
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
448 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
449 * This is done by giving the client a faked key, just so we can convince
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
450 * them to call aim_send_login right away, which will detect the session
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
451 * flag that says this is XOR login and ignore the key, sending an ICQ
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
452 * login request instead of the normal SNAC one.
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
453 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
454 * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/.
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
455 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
456 * XXX This may cause problems if the client relies on callbacks only
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
457 * being called from the context of aim_rxdispatch()...
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
458 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
459 */
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
460 static int goddamnicq(aim_session_t *sess, aim_conn_t *conn, const char *sn)
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
461 {
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
462 aim_frame_t fr;
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
463 aim_rxcallback_t userfunc;
10267
9cafe038c95e [gaim-migrate @ 11413]
Mark Doliner <mark@kingant.net>
parents: 7631
diff changeset
464
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
465 fr.conn = conn;
10267
9cafe038c95e [gaim-migrate @ 11413]
Mark Doliner <mark@kingant.net>
parents: 7631
diff changeset
466
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
467 if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007)))
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
468 userfunc(sess, &fr, "");
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
469
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
470 return 0;
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
471 }
10693
f7431a6ff0cb [gaim-migrate @ 12245]
Mark Doliner <mark@kingant.net>
parents: 10644
diff changeset
472 #endif
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
473
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
474 /*
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
475 * Subtype 0x0006
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
476 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
477 * In AIM 3.5 protocol, the first stage of login is to request login from the
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
478 * Authorizer, passing it the screen name for verification. If the name is
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
479 * invalid, a 0017/0003 is spit back, with the standard error contents. If
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
480 * valid, a 0017/0007 comes back, which is the signal to send it the main
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
481 * login command (0017/0002).
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
482 *
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
483 */
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
484 faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn)
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
485 {
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
486 aim_frame_t *fr;
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
487 aim_snacid_t snacid;
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
488 aim_tlvlist_t *tl = NULL;
10267
9cafe038c95e [gaim-migrate @ 11413]
Mark Doliner <mark@kingant.net>
parents: 7631
diff changeset
489
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
490 if (!sess || !conn || !sn)
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
491 return -EINVAL;
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
492
10693
f7431a6ff0cb [gaim-migrate @ 12245]
Mark Doliner <mark@kingant.net>
parents: 10644
diff changeset
493 #ifdef USE_XOR_FOR_ICQ
7313
be7c1468c6a7 [gaim-migrate @ 7897]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
494 if (isdigit(sn[0]))
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
495 return goddamnicq(sess, conn, sn);
10693
f7431a6ff0cb [gaim-migrate @ 12245]
Mark Doliner <mark@kingant.net>
parents: 10644
diff changeset
496 #endif
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
497
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
498 aim_sendflapver(sess, conn);
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
499
10464
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
500 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(sn)+8 )))
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
501 return -ENOMEM;
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
502
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
503 snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0);
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
504 aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid);
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
505
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
506 aim_tlvlist_add_str(&tl, 0x0001, sn);
10464
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
507
10644
de96582ba40a [gaim-migrate @ 12155]
Mark Doliner <mark@kingant.net>
parents: 10467
diff changeset
508 /* Tell the server we support SecurID logins. */
10464
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
509 aim_tlvlist_add_noval(&tl, 0x004b);
10644
de96582ba40a [gaim-migrate @ 12155]
Mark Doliner <mark@kingant.net>
parents: 10467
diff changeset
510
de96582ba40a [gaim-migrate @ 12155]
Mark Doliner <mark@kingant.net>
parents: 10467
diff changeset
511 /* Unknown. Sent in recent WinAIM clients.*/
10464
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
512 aim_tlvlist_add_noval(&tl, 0x005a);
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
513
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
514 aim_tlvlist_write(&fr->data, &tl);
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
515 aim_tlvlist_free(&tl);
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
516
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
517 aim_tx_enqueue(sess, fr);
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
518
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
519 return 0;
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
520 }
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
521
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
522 /*
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
523 * Subtype 0x0007
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
524 *
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
525 * Middle handler for 0017/0007 SNACs. Contains the auth key prefixed
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
526 * by only its length in a two byte word.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
527 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528 * Calls the client, which should then use the value to call aim_send_login.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
529 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
530 */
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
531 static int keyparse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
532 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
533 int keylen, ret = 1;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
534 aim_rxcallback_t userfunc;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
535 char *keystr;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
536
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
537 keylen = aimbs_get16(bs);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
538 keystr = aimbs_getstr(bs, keylen);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539
4230
9f729d6d88a6 [gaim-migrate @ 4475]
Mark Doliner <mark@kingant.net>
parents: 4102
diff changeset
540 /* XXX - When GiantGrayPanda signed on AIM I got a thing asking me to register
9f729d6d88a6 [gaim-migrate @ 4475]
Mark Doliner <mark@kingant.net>
parents: 4102
diff changeset
541 * for the netscape network. This SNAC had a type 0x0058 TLV with length 10.
9f729d6d88a6 [gaim-migrate @ 4475]
Mark Doliner <mark@kingant.net>
parents: 4102
diff changeset
542 * Data is 0x0007 0004 3e19 ae1e 0006 0004 0000 0005 */
9f729d6d88a6 [gaim-migrate @ 4475]
Mark Doliner <mark@kingant.net>
parents: 4102
diff changeset
543
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
544 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
545 ret = userfunc(sess, rx, keystr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
546
10267
9cafe038c95e [gaim-migrate @ 11413]
Mark Doliner <mark@kingant.net>
parents: 7631
diff changeset
547 free(keystr);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
548
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
549 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
550 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
551
10464
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
552 /**
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
553 * Subtype 0x000a
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
554 *
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
555 * Receive SecurID request.
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
556 */
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
557 static int got_securid_request(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
558 {
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
559 int ret = 0;
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
560 aim_rxcallback_t userfunc;
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
561
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
562 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
563 ret = userfunc(sess, rx);
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
564
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
565 return ret;
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
566 }
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
567
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
568 /**
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
569 * Subtype 0x000b
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
570 *
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
571 * Send SecurID response.
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
572 */
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
573 faim_export int aim_auth_securid_send(aim_session_t *sess, const char *securid)
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
574 {
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
575 aim_conn_t *conn;
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
576 aim_frame_t *fr;
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
577 aim_snacid_t snacid;
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
578 int len;
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
579
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
580 if (!sess || !(conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH)) || !securid)
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
581 return -EINVAL;
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
582
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
583 len = strlen(securid);
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
584
10467
cbbf5af9e520 [gaim-migrate @ 11747]
Mark Doliner <mark@kingant.net>
parents: 10464
diff changeset
585 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+len)))
10464
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
586 return -ENOMEM;
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
587
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
588 snacid = aim_cachesnac(sess, AIM_CB_FAM_ATH, AIM_CB_ATH_SECURID_RESPONSE, 0x0000, NULL, 0);
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
589 aim_putsnac(&fr->data, AIM_CB_FAM_ATH, AIM_CB_ATH_SECURID_RESPONSE, 0x0000, 0);
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
590
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
591 aimbs_put16(&fr->data, len);
10990
8d74ae785a46 [gaim-migrate @ 12828]
Mark Doliner <mark@kingant.net>
parents: 10986
diff changeset
592 aimbs_putstr(&fr->data, securid);
10464
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
593
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
594 aim_tx_enqueue(sess, fr);
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
595
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
596 return 0;
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
597 }
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
598
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
599 static void auth_shutdown(aim_session_t *sess, aim_module_t *mod)
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
600 {
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
601 if (sess->authinfo) {
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
602 free(sess->authinfo->sn);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
603 free(sess->authinfo->bosip);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
604 free(sess->authinfo->errorurl);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
605 free(sess->authinfo->email);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
606 free(sess->authinfo->chpassurl);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
607 free(sess->authinfo->latestrelease.name);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
608 free(sess->authinfo->latestrelease.url);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
609 free(sess->authinfo->latestrelease.info);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
610 free(sess->authinfo->latestbeta.name);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
611 free(sess->authinfo->latestbeta.url);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
612 free(sess->authinfo->latestbeta.info);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
613 free(sess->authinfo);
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
614 }
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
615 }
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
616
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
617 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
618 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
620 if (snac->subtype == 0x0003)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
621 return parse(sess, mod, rx, snac, bs);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
622 else if (snac->subtype == 0x0007)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
623 return keyparse(sess, mod, rx, snac, bs);
10464
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
624 else if (snac->subtype == 0x000a)
61ef9a964574 [gaim-migrate @ 11739]
Mark Doliner <mark@kingant.net>
parents: 10267
diff changeset
625 return got_securid_request(sess, mod, rx, snac, bs);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
627 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
629
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
630 faim_internal int auth_modfirst(aim_session_t *sess, aim_module_t *mod)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
631 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
632
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
633 mod->family = 0x0017;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
634 mod->version = 0x0000;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
635 mod->flags = 0;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
636 strncpy(mod->name, "auth", sizeof(mod->name));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
637 mod->snachandler = snachandler;
4102
c5ce82228a2f [gaim-migrate @ 4317]
Mark Doliner <mark@kingant.net>
parents: 4070
diff changeset
638 mod->shutdown = auth_shutdown;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
639
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
640 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
641 }