comparison src/protocols/oscar/auth.c @ 5345:bfe98c4d331e

[gaim-migrate @ 5721] ICQ has a maximum password length of 8 characters, apparently. I made Gaim truncate that shizzle for ICQ. This fixes this: http://sourceforge.net/tracker/?func=detail&aid=732409&group_id=235&atid=100235 committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 10 May 2003 15:33:48 +0000
parents 7c9f3d0fe8b2
children 04dc7fe68889
comparison
equal deleted inserted replaced
5344:fda2d94b9434 5345:bfe98c4d331e
5 * non-SNAC login. 5 * non-SNAC login.
6 * 6 *
7 */ 7 */
8 8
9 #define FAIM_INTERNAL 9 #define FAIM_INTERNAL
10 #include <aim.h> 10 #include <aim.h>
11 11
12 #include "md5.h" 12 #include "md5.h"
13 13
14 static int aim_encode_password(const char *password, unsigned char *encoded); 14 static int aim_encode_password(const char *password, unsigned char *encoded);
15 15
154 */ 154 */
155 static int goddamnicq2(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password, struct client_info_s *ci) 155 static int goddamnicq2(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password, struct client_info_s *ci)
156 { 156 {
157 aim_frame_t *fr; 157 aim_frame_t *fr;
158 aim_tlvlist_t *tl = NULL; 158 aim_tlvlist_t *tl = NULL;
159 int passwdlen;
159 char *password_encoded; 160 char *password_encoded;
160 161
161 if (!(password_encoded = (char *) malloc(strlen(password)))) 162 passwdlen = strlen(password);
163 if (!(password_encoded = (char *)malloc(passwdlen+1)))
162 return -ENOMEM; 164 return -ENOMEM;
165 if (passwdlen > MAXICQPASSLEN)
166 passwdlen = MAXICQPASSLEN;
163 167
164 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 1152))) { 168 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 1152))) {
165 free(password_encoded); 169 free(password_encoded);
166 return -ENOMEM; 170 return -ENOMEM;
167 } 171 }
168 172
169 aim_encode_password(password, password_encoded); 173 aim_encode_password(password, password_encoded);
170 174
171 aimbs_put32(&fr->data, 0x00000001); /* FLAP Version */ 175 aimbs_put32(&fr->data, 0x00000001); /* FLAP Version */
172 aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn); 176 aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn);
173 aim_addtlvtochain_raw(&tl, 0x0002, strlen(password), password_encoded); 177 aim_addtlvtochain_raw(&tl, 0x0002, passwdlen, password_encoded);
174 178
175 if (ci->clientstring) 179 if (ci->clientstring)
176 aim_addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); 180 aim_addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring);
177 aim_addtlvtochain16(&tl, 0x0016, (fu16_t)ci->clientid); 181 aim_addtlvtochain16(&tl, 0x0016, (fu16_t)ci->clientid);
178 aim_addtlvtochain16(&tl, 0x0017, (fu16_t)ci->major); 182 aim_addtlvtochain16(&tl, 0x0017, (fu16_t)ci->major);