4 Deals with the authorizer.
10 /* this just pushes the passed cookie onto the passed connection -- NO SNAC! */
11 int aim_auth_sendcookie(struct aim_session_t *sess,
12 struct aim_conn_t *conn,
15 struct command_tx_struct newpacket;
21 newpacket.conn = aim_getconn_type(sess, AIM_CONN_TYPE_AUTH);
23 newpacket.conn = conn;
25 newpacket.type = 0x0001; /* channel 1 (no SNACs, you know) */
27 newpacket.commandlen = 4 + 2 + 2 + AIM_COOKIELEN;
28 newpacket.data = (char *) calloc(1, newpacket.commandlen);
30 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0000);
31 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001);
32 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0006);
33 curbyte += aimutil_put16(newpacket.data+curbyte, AIM_COOKIELEN);
34 memcpy(&(newpacket.data[curbyte]), chipsahoy, AIM_COOKIELEN);
36 aim_tx_enqueue(sess, &newpacket);
41 u_long aim_auth_clientready(struct aim_session_t *sess,
42 struct aim_conn_t *conn)
44 struct command_tx_struct newpacket;
50 newpacket.conn = aim_getconn_type(sess, AIM_CONN_TYPE_AUTH);
52 newpacket.conn = conn;
54 newpacket.type = 0x0002;
56 newpacket.commandlen = 26;
57 newpacket.data = (u_char *) malloc(newpacket.commandlen);
59 curbyte += aim_putsnac(newpacket.data+curbyte, 0x0001, 0x0002, 0x0000, sess->snac_nextid);
60 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001);
61 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0002);
62 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001);
63 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0013);
64 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0007);
65 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001);
66 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001);
67 curbyte += aimutil_put16(newpacket.data+curbyte, 0x0001);
69 aim_tx_enqueue(sess, &newpacket);
72 struct aim_snac_t snac;
74 snac.id = sess->snac_nextid;
81 aim_newsnac(sess, &snac);
84 return (sess->snac_nextid++);
87 u_long aim_auth_changepasswd(struct aim_session_t *sess,
88 struct aim_conn_t *conn,
89 char *new, char *current)
91 struct command_tx_struct newpacket;
97 newpacket.conn = aim_getconn_type(sess, AIM_CONN_TYPE_AUTH);
99 newpacket.conn = conn;
101 newpacket.type = 0x0002;
103 newpacket.commandlen = 10 + 4 + strlen(current) + 4 + strlen(new);
104 newpacket.data = (char *) malloc(newpacket.commandlen);
106 aim_putsnac(newpacket.data, 0x0007, 0x0004, 0x0000, sess->snac_nextid);
108 /* current password TLV t(0002) */
110 newpacket.data[i++] = 0x00;
111 newpacket.data[i++] = 0x02;
112 newpacket.data[i++] = 0x00;
113 newpacket.data[i++] = strlen(current) & 0xff;
114 memcpy(&(newpacket.data[i]), current, strlen(current));
115 i += strlen(current);
117 /* new password TLV t(0012) */
118 newpacket.data[i++] = 0x00;
119 newpacket.data[i++] = 0x12;
120 newpacket.data[i++] = 0x00;
121 newpacket.data[i++] = strlen(new) & 0xff;
122 memcpy(&(newpacket.data[i]), new, strlen(new));
125 aim_tx_enqueue(sess, &newpacket);
128 struct aim_snac_t snac;
130 snac.id = sess->snac_nextid;
131 snac.family = 0x0001;
137 aim_newsnac(sess, &snac);
140 return (sess->snac_nextid++);