# HG changeset patch # User Mark Doliner # Date 1042276779 0 # Node ID 79d871c11eb9ef4beef8202dc7da94c77c9d3bf7 # Parent 78a3d2caf84c96af1649a9496c5a77c818e23136 [gaim-migrate @ 4546] This changes to authorization cookie from a fixed length of 0x0100 bytes to a dynamic length. The cookie AOL sends is always 0x0100 bytes, but there was a bug report saying, "I found that Gaim doesn't work with iserverd because it uses hardcoded authorization cookie length. Why don't you use TLV length value as auth cookie length ? ICQ2k+ and winaim works without problems with 64 byte cookies... AOL can just change cookie len and gaim will became useless..." I don't know about useless... but he does have a point. committer: Tailor Script diff -r 78a3d2caf84c -r 79d871c11eb9 src/protocols/oscar/aim.h --- a/src/protocols/oscar/aim.h Sat Jan 11 08:40:25 2003 +0000 +++ b/src/protocols/oscar/aim.h Sat Jan 11 09:19:39 2003 +0000 @@ -113,11 +113,6 @@ */ #define MAXCHATMSGLEN 512 -/* - * Standard size of an AIM authorization cookie - */ -#define AIM_COOKIELEN 0x100 - #define AIM_MD5_STRING "AOL Instant Messenger (SM)" /* @@ -595,6 +590,7 @@ fu16_t regstatus; char *email; char *bosip; + fu16_t cookielen; fu8_t *cookie; char *chpassurl; struct aim_clientrelease latestrelease; @@ -605,6 +601,7 @@ struct aim_redirect_data { fu16_t group; const char *ip; + fu16_t cookielen; const fu8_t *cookie; struct { /* group == AIM_CONN_TYPE_CHAT */ fu16_t exchange; @@ -1054,7 +1051,7 @@ /* auth.c */ -faim_export int aim_sendcookie(aim_session_t *, aim_conn_t *, const fu8_t *); +faim_export int aim_sendcookie(aim_session_t *, aim_conn_t *, const fu16_t length, const fu8_t *); faim_export int aim_admin_changepasswd(aim_session_t *, aim_conn_t *, const char *newpw, const char *curpw); faim_export int aim_admin_reqconfirm(aim_session_t *sess, aim_conn_t *conn); diff -r 78a3d2caf84c -r 79d871c11eb9 src/protocols/oscar/auth.c --- a/src/protocols/oscar/auth.c Sat Jan 11 08:40:25 2003 +0000 +++ b/src/protocols/oscar/auth.c Sat Jan 11 09:19:39 2003 +0000 @@ -21,16 +21,16 @@ * be the first thing you send. * */ -faim_export int aim_sendcookie(aim_session_t *sess, aim_conn_t *conn, const fu8_t *chipsahoy) +faim_export int aim_sendcookie(aim_session_t *sess, aim_conn_t *conn, const fu16_t length, const fu8_t *chipsahoy) { aim_frame_t *fr; aim_tlvlist_t *tl = NULL; - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x0001, 4+2+2+AIM_COOKIELEN))) + if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x0001, 4+2+2+length))) return -ENOMEM; aimbs_put32(&fr->data, 0x00000001); - aim_addtlvtochain_raw(&tl, 0x0006, AIM_COOKIELEN, chipsahoy); + aim_addtlvtochain_raw(&tl, 0x0006, length, chipsahoy); aim_writetlvchain(&fr->data, &tl); aim_freetlvchain(&tl); @@ -392,6 +392,7 @@ tmptlv = aim_gettlv(tlvlist, 0x0006, 1); + info->cookielen = tmptlv->length; info->cookie = tmptlv->value; } diff -r 78a3d2caf84c -r 79d871c11eb9 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Sat Jan 11 08:40:25 2003 +0000 +++ b/src/protocols/oscar/oscar.c Sat Jan 11 09:19:39 2003 +0000 @@ -815,7 +815,7 @@ debug_printf("inside auth_resp (Screen name: %s)\n", info->sn); - if (info->errorcode || !info->bosip || !info->cookie) { + if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { char buf[256]; switch (info->errorcode) { case 0x05: @@ -930,7 +930,7 @@ od->killme = TRUE; return 0; } - aim_sendcookie(sess, bosconn, info->cookie); + aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); gaim_input_remove(gc->inpa); return 1; @@ -1318,7 +1318,7 @@ g_free(host); return 1; } - aim_sendcookie(sess, tstconn, redir->cookie); + aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); break; case 0xd: /* ChatNav */ @@ -1338,7 +1338,7 @@ g_free(host); return 1; } - aim_sendcookie(sess, tstconn, redir->cookie); + aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); break; case 0xe: { /* Chat */ @@ -1373,7 +1373,7 @@ g_free(ccon); return 1; } - aim_sendcookie(sess, tstconn, redir->cookie); + aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); debug_printf("Connected to chat room %s exchange %hu\n", ccon->name, ccon->exchange); } break; @@ -1393,7 +1393,7 @@ g_free(host); return 1; } - aim_sendcookie(sess, tstconn, redir->cookie); + aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); } break; default: /* huh? */ diff -r 78a3d2caf84c -r 79d871c11eb9 src/protocols/oscar/service.c --- a/src/protocols/oscar/service.c Sat Jan 11 08:40:25 2003 +0000 +++ b/src/protocols/oscar/service.c Sat Jan 11 09:19:39 2003 +0000 @@ -119,6 +119,7 @@ redir.group = aim_gettlv16(tlvlist, 0x000d, 1); redir.ip = aim_gettlv_str(tlvlist, 0x0005, 1); + redir.cookielen = aim_gettlv(tlvlist, 0x0006, 1)->length; redir.cookie = aim_gettlv_str(tlvlist, 0x0006, 1); /* Fetch original SNAC so we can get csi if needed */