Mercurial > pidgin
comparison libfaim/aim_auth.c @ 237:6ced2f1c8b24
[gaim-migrate @ 247]
How cool is this, libfaim is making a comeback. I completely redid everything,
as was necessary because of the updates to libfaim since gaim 0.9.7. You can
sign on and send/recv IMs, but there's a bad lag between display updates that
I haven't figured out how to fix yet.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 20 May 2000 00:30:53 +0000 |
parents | 68b230f8da5f |
children | 0f14e6d8a51b |
comparison
equal
deleted
inserted
replaced
236:62d470738cc7 | 237:6ced2f1c8b24 |
---|---|
3 | 3 |
4 Deals with the authorizer. | 4 Deals with the authorizer. |
5 | 5 |
6 */ | 6 */ |
7 | 7 |
8 #include "aim.h" | 8 #include <aim.h> |
9 | 9 |
10 /* this just pushes the passed cookie onto the passed connection -- NO SNAC! */ | 10 /* this just pushes the passed cookie onto the passed connection -- NO SNAC! */ |
11 int aim_auth_sendcookie(struct aim_conn_t *conn, char *chipsahoy) | 11 int aim_auth_sendcookie(struct aim_session_t *sess, |
12 struct aim_conn_t *conn, | |
13 u_char *chipsahoy) | |
12 { | 14 { |
13 struct command_tx_struct newpacket; | 15 struct command_tx_struct *newpacket; |
14 int curbyte=0; | 16 int curbyte=0; |
15 | 17 |
16 newpacket.lock = 1; | 18 if (!(newpacket = aim_tx_new(0x0001, conn, 4+2+2+AIM_COOKIELEN))) |
19 return -1; | |
17 | 20 |
18 if (conn==NULL) | 21 newpacket->lock = 1; |
19 newpacket.conn = aim_getconn_type(AIM_CONN_TYPE_AUTH); | |
20 else | |
21 newpacket.conn = conn; | |
22 | 22 |
23 newpacket.type = 0x0001; /* channel 1 (no SNACs, you know) */ | 23 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000); |
24 | 24 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); |
25 newpacket.commandlen = 4 + 2 + 2 + 0x100; | 25 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0006); |
26 newpacket.data = (char *) calloc(1, newpacket.commandlen); | 26 curbyte += aimutil_put16(newpacket->data+curbyte, AIM_COOKIELEN); |
27 | 27 memcpy(newpacket->data+curbyte, chipsahoy, AIM_COOKIELEN); |
28 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0000); | |
29 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001); | |
30 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0006); | |
31 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0100); | |
32 memcpy(&(newpacket.data[curbyte]), chipsahoy, 0x100); | |
33 | 28 |
34 aim_tx_enqueue(&newpacket); | 29 return aim_tx_enqueue(sess, newpacket); |
35 | |
36 return 0; | |
37 } | 30 } |
38 | 31 |
39 u_long aim_auth_clientready(struct aim_conn_t *conn) | 32 u_long aim_auth_clientready(struct aim_session_t *sess, |
33 struct aim_conn_t *conn) | |
40 { | 34 { |
41 struct command_tx_struct newpacket; | 35 struct command_tx_struct *newpacket; |
42 int curbyte = 0; | 36 int curbyte = 0; |
43 | 37 |
44 newpacket.lock = 1; | 38 if (!(newpacket = aim_tx_new(0x0002, conn, 26))) |
39 return -1; | |
45 | 40 |
46 if (conn==NULL) | 41 newpacket->lock = 1; |
47 newpacket.conn = aim_getconn_type(AIM_CONN_TYPE_AUTH); | |
48 else | |
49 newpacket.conn = conn; | |
50 | 42 |
51 newpacket.type = 0x0002; | 43 curbyte += aim_putsnac(newpacket->data+curbyte, 0x0001, 0x0002, 0x0000, sess->snac_nextid); |
52 | 44 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); |
53 newpacket.commandlen = 26; | 45 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002); |
54 newpacket.data = (char *) malloc(newpacket.commandlen); | 46 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); |
55 | 47 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0013); |
56 curbyte += aim_putsnac(newpacket.data+curbyte, 0x0001, 0x0002, 0x0000, aim_snac_nextid); | 48 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0007); |
57 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001); | 49 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); |
58 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0002); | 50 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); |
59 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001); | 51 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); |
60 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0013); | |
61 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0007); | |
62 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001); | |
63 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001); | |
64 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001); | |
65 | 52 |
66 aim_tx_enqueue(&newpacket); | 53 aim_tx_enqueue(sess, newpacket); |
67 | 54 |
68 { | 55 { |
69 struct aim_snac_t snac; | 56 struct aim_snac_t snac; |
70 | 57 |
71 snac.id = aim_snac_nextid; | 58 snac.id = sess->snac_nextid; |
72 snac.family = 0x0001; | 59 snac.family = 0x0001; |
73 snac.type = 0x0004; | 60 snac.type = 0x0004; |
74 snac.flags = 0x0000; | 61 snac.flags = 0x0000; |
75 | 62 |
76 snac.data = NULL; | 63 snac.data = NULL; |
77 | 64 |
78 aim_newsnac(&snac); | 65 aim_newsnac(sess, &snac); |
79 } | 66 } |
80 | 67 |
81 return (aim_snac_nextid++); | 68 return (sess->snac_nextid++); |
82 } | 69 } |
83 | 70 |
84 u_long aim_auth_changepasswd(struct aim_conn_t *conn, char *new, char *current) | 71 u_long aim_auth_changepasswd(struct aim_session_t *sess, |
72 struct aim_conn_t *conn, | |
73 char *new, char *current) | |
85 { | 74 { |
86 struct command_tx_struct newpacket; | 75 struct command_tx_struct *newpacket; |
87 int i; | 76 int i; |
88 | 77 |
89 newpacket.lock = 1; | 78 if (!(newpacket = aim_tx_new(0x0002, conn, 10+4+strlen(current)+4+strlen(new)))) |
79 return -1; | |
90 | 80 |
91 if (conn==NULL) | 81 newpacket->lock = 1; |
92 newpacket.conn = aim_getconn_type(AIM_CONN_TYPE_AUTH); | |
93 else | |
94 newpacket.conn = conn; | |
95 | 82 |
96 newpacket.type = 0x0002; | 83 i = aim_putsnac(newpacket->data, 0x0007, 0x0004, 0x0000, sess->snac_nextid); |
97 | |
98 newpacket.commandlen = 10 + 4 + strlen(current) + 4 + strlen(new); | |
99 newpacket.data = (char *) malloc(newpacket.commandlen); | |
100 | |
101 newpacket.data[0] = 0x00; | |
102 newpacket.data[1] = 0x07; | |
103 | |
104 newpacket.data[2] = 0x00; | |
105 newpacket.data[3] = 0x04; | |
106 | |
107 newpacket.data[4] = 0x00; | |
108 newpacket.data[5] = 0x00; | |
109 | |
110 /* SNAC reqid */ | |
111 newpacket.data[6] = (aim_snac_nextid >> 24) & 0xFF; | |
112 newpacket.data[7] = (aim_snac_nextid >> 16) & 0xFF; | |
113 newpacket.data[8] = (aim_snac_nextid >> 8) & 0xFF; | |
114 newpacket.data[9] = (aim_snac_nextid) & 0xFF; | |
115 | 84 |
116 /* current password TLV t(0002) */ | 85 /* current password TLV t(0002) */ |
117 i = 10; | 86 i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(current), current); |
118 newpacket.data[i++] = 0x00; | |
119 newpacket.data[i++] = 0x02; | |
120 newpacket.data[i++] = 0x00; | |
121 newpacket.data[i++] = strlen(current) & 0xff; | |
122 memcpy(&(newpacket.data[i]), current, strlen(current)); | |
123 i += strlen(current); | |
124 | 87 |
125 /* new password TLV t(0012) */ | 88 /* new password TLV t(0012) */ |
126 newpacket.data[i++] = 0x00; | 89 i += aim_puttlv_str(newpacket->data+i, 0x0012, strlen(new), new); |
127 newpacket.data[i++] = 0x12; | |
128 newpacket.data[i++] = 0x00; | |
129 newpacket.data[i++] = strlen(new) & 0xff; | |
130 memcpy(&(newpacket.data[i]), new, strlen(new)); | |
131 i+=strlen(new); | |
132 | 90 |
133 aim_tx_enqueue(&newpacket); | 91 aim_tx_enqueue(sess, newpacket); |
134 | 92 |
135 { | 93 { |
136 struct aim_snac_t snac; | 94 struct aim_snac_t snac; |
137 | 95 |
138 snac.id = aim_snac_nextid; | 96 snac.id = sess->snac_nextid; |
139 snac.family = 0x0001; | 97 snac.family = 0x0001; |
140 snac.type = 0x0004; | 98 snac.type = 0x0004; |
141 snac.flags = 0x0000; | 99 snac.flags = 0x0000; |
142 | 100 |
143 snac.data = NULL; | 101 snac.data = NULL; |
144 | 102 |
145 aim_newsnac(&snac); | 103 aim_newsnac(sess, &snac); |
146 } | 104 } |
147 | 105 |
148 return (aim_snac_nextid++); | 106 return (sess->snac_nextid++); |
149 } | 107 } |