comparison libpurple/protocols/msnp9/nexus.c @ 22394:85fbff54425e

Truncate password to 16 characters on MSN, before encoding. This should fix connecting for people who thing they have a password longer than 16 characters, but don't actually (because it's not possible to set one). I tried this in 2.3.0 but got it badly wrong (truncated after encoding), and I've been scared off trying it again before now.
author Stu Tomlinson <stu@nosnilmot.com>
date Fri, 29 Feb 2008 21:11:47 +0000
parents c6487d5385f9
children 1e7713b5e068
comparison
equal deleted inserted replaced
22393:2d0bfa78f732 22394:85fbff54425e
319 login_connect_cb(gpointer data, PurpleSslConnection *gsc, 319 login_connect_cb(gpointer data, PurpleSslConnection *gsc,
320 PurpleInputCondition cond) 320 PurpleInputCondition cond)
321 { 321 {
322 MsnNexus *nexus; 322 MsnNexus *nexus;
323 MsnSession *session; 323 MsnSession *session;
324 char *username, *password; 324 char *username, *password, *encpass;
325 char *request_str, *head, *tail; 325 char *request_str, *head, *tail;
326 char *buffer = NULL; 326 char *buffer = NULL;
327 guint32 ctint; 327 guint32 ctint;
328 328
329 nexus = data; 329 nexus = data;
335 msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); 335 msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE);
336 336
337 username = 337 username =
338 g_strdup(purple_url_encode(purple_account_get_username(session->account))); 338 g_strdup(purple_url_encode(purple_account_get_username(session->account)));
339 339
340 password = 340 password = g_strndup(purple_connection_get_password(session->account->gc), 16);
341 g_strdup(purple_url_encode(purple_connection_get_password(session->account->gc))); 341 encpass = g_strdup(purple_url_encode(password));
342 g_free(password);
342 343
343 ctint = strtoul((char *)g_hash_table_lookup(nexus->challenge_data, "ct"), NULL, 10) + 200; 344 ctint = strtoul((char *)g_hash_table_lookup(nexus->challenge_data, "ct"), NULL, 10) + 200;
344 345
345 head = g_strdup_printf( 346 head = g_strdup_printf(
346 "GET %s HTTP/1.1\r\n" 347 "GET %s HTTP/1.1\r\n"
366 nexus_challenge_data_lookup(nexus->challenge_data, "ver"), 367 nexus_challenge_data_lookup(nexus->challenge_data, "ver"),
367 nexus_challenge_data_lookup(nexus->challenge_data, "tpf"), 368 nexus_challenge_data_lookup(nexus->challenge_data, "tpf"),
368 nexus->login_host); 369 nexus->login_host);
369 370
370 buffer = g_strdup_printf("%s,pwd=XXXXXXXX,%s\r\n", head, tail); 371 buffer = g_strdup_printf("%s,pwd=XXXXXXXX,%s\r\n", head, tail);
371 request_str = g_strdup_printf("%s,pwd=%s,%s\r\n", head, password, tail); 372 request_str = g_strdup_printf("%s,pwd=%s,%s\r\n", head, encpass, tail);
372 373
373 purple_debug_misc("msn", "Sending: {%s}\n", buffer); 374 purple_debug_misc("msn", "Sending: {%s}\n", buffer);
374 375
375 g_free(buffer); 376 g_free(buffer);
376 g_free(head); 377 g_free(head);
377 g_free(tail); 378 g_free(tail);
378 g_free(username); 379 g_free(username);
379 g_free(password); 380 g_free(encpass);
380 381
381 nexus->write_buf = request_str; 382 nexus->write_buf = request_str;
382 nexus->written_len = 0; 383 nexus->written_len = 0;
383 384
384 nexus->read_len = 0; 385 nexus->read_len = 0;