From: mid Date: Tue, 27 Mar 2001 00:04:26 +0000 (+0000) Subject: - Mon Mar 26 15:57:41 PST 2001 X-Git-Tag: rel_0_99_2~56 X-Git-Url: http://andersk.mit.edu/gitweb/libfaim.git/commitdiff_plain/e80a0fa9198d4acd23acebd7e1bd5f6113b469bb - Mon Mar 26 15:57:41 PST 2001 - Hrmph. - Debuglevel wasn't getting set properly by aim_session_init --- diff --git a/CHANGES b/CHANGES index 3ba96eb..2859499 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ No release numbers ------------------ + - Mon Mar 26 15:57:41 PST 2001 + - Hrmph. + - Debuglevel wasn't getting set properly by aim_session_init + - Sat Mar 24 03:16:32 UTC 2001 - vaargs to msgerror and locateerror swapped - ** CLIENT CHANGE: Reason code comes before SN now. This is so that diff --git a/include/aim.h b/include/aim.h index 6a78c77..a0479c8 100644 --- a/include/aim.h +++ b/include/aim.h @@ -636,6 +636,9 @@ faim_export int aim_oft_getfile_end(struct aim_session_t *sess, struct aim_conn_ #define AIM_CAPS_GAMES 0x40 #define AIM_CAPS_SAVESTOCKS 0x80 +faim_export int aim_0002_000b(struct aim_session_t *sess, struct aim_conn_t *conn, const char *sn); +faim_export int aim_0001_0020(struct aim_session_t *sess, struct aim_conn_t *conn); + #define AIM_GETINFO_GENERALINFO 0x00001 #define AIM_GETINFO_AWAYMESSAGE 0x00003 diff --git a/src/bos.c b/src/bos.c index 9a6a0de..247251e 100644 --- a/src/bos.c +++ b/src/bos.c @@ -19,6 +19,34 @@ faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *sess, return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask); } +faim_export int aim_0001_0020(struct aim_session_t *sess, struct aim_conn_t *conn) +{ + struct command_tx_struct *tx; + int i = 0; + + if (!sess || !conn) + return 0; + + if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10+2+16))) + return -1; + + tx->lock = 1; + + /* Hummm.... */ + i = aim_putsnac(tx->data, 0x0001, 0x0020, 0x0000, sess->snac_nextid++); + i += aimutil_put16(tx->data+i, 0x0010); + i += aimutil_put32(tx->data+i, 0x469bf5e7); + i += aimutil_put32(tx->data+i, 0x01a19b28); + i += aimutil_put32(tx->data+i, 0x54c59ea6); + i += aimutil_put32(tx->data+i, 0x88eae54a); + + tx->commandlen = i; + tx->lock = 0; + aim_tx_enqueue(sess, tx); + + return 0; +} + static int rights(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen) { rxcallback_t userfunc; diff --git a/src/conn.c b/src/conn.c index 5902b27..f9f211c 100644 --- a/src/conn.c +++ b/src/conn.c @@ -752,7 +752,7 @@ faim_export void aim_session_init(struct aim_session_t *sess, unsigned long flag sess->snac_nextid = 0x00000001; sess->flags = 0; - sess->debug = 0; + sess->debug = debuglevel; sess->debugcb = defaultdebugcb; sess->modlistv = NULL; diff --git a/src/info.c b/src/info.c index 4c67a6b..db84a71 100644 --- a/src/info.c +++ b/src/info.c @@ -526,6 +526,30 @@ faim_export int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_con return 0; } +faim_export int aim_0002_000b(struct aim_session_t *sess, struct aim_conn_t *conn, const char *sn) +{ + struct command_tx_struct *tx; + int i = 0; + + if (!sess || !conn || !sn) + return 0; + + if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10+1+strlen(sn)))) + return -1; + + tx->lock = 1; + + i = aim_putsnac(tx->data, 0x0002, 0x000b, 0x0000, sess->snac_nextid); + i += aimutil_put8(tx->data+i, strlen(sn)); + i += aimutil_putstr(tx->data+i, sn, strlen(sn)); + + tx->commandlen = i; + tx->lock = 0; + aim_tx_enqueue(sess, tx); + + return 0; +} + static int rights(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen) { struct aim_tlvlist_t *tlvlist; diff --git a/src/login.c b/src/login.c index 4b55be0..37fe042 100644 --- a/src/login.c +++ b/src/login.c @@ -189,9 +189,7 @@ faim_export int aim_send_login (struct aim_session_t *sess, free(password_encoded); } - /* XXX is clientstring required by oscar? */ - if (strlen(clientinfo->clientstring)) - curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0003, strlen(clientinfo->clientstring), clientinfo->clientstring); + curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0003, strlen(clientinfo->clientstring), clientinfo->clientstring); if (sess->flags & AIM_SESS_FLAGS_SNACLOGIN) { @@ -201,9 +199,6 @@ faim_export int aim_send_login (struct aim_session_t *sess, curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, (unsigned short)clientinfo->minor2); curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, (unsigned short)clientinfo->build); - curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, clientinfo->unknown); - curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0009, 0x0015); - } else { /* Use very specific version numbers, to further indicate the hack. */ curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, 0x010a); @@ -214,16 +209,14 @@ faim_export int aim_send_login (struct aim_session_t *sess, curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, 0x00000055); } - if (strlen(clientinfo->country)) - curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000f, strlen(clientinfo->country), clientinfo->country); - else - curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000f, 2, "us"); - - if (strlen(clientinfo->lang)) - curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000e, strlen(clientinfo->lang), clientinfo->lang); - else - curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000e, 2, "en"); + curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000e, strlen(clientinfo->country), clientinfo->country); + curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000f, strlen(clientinfo->lang), clientinfo->lang); + if (sess->flags & AIM_SESS_FLAGS_SNACLOGIN) { + curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, clientinfo->unknown); + curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0009, 0x0015); + } + newpacket->commandlen = curbyte; newpacket->lock = 0; diff --git a/src/misc.c b/src/misc.c index c8975ef..29f736f 100644 --- a/src/misc.c +++ b/src/misc.c @@ -215,10 +215,10 @@ faim_export unsigned long aim_bos_setprofile(struct aim_session_t *sess, return -1; i += aim_putsnac(newpacket->data, 0x0002, 0x004, 0x0000, sess->snac_nextid); - i += aim_puttlv_str(newpacket->data+i, 0x0001, strlen("text/x-aolrtf; charset=\"us-ascii\""), "text/x-aolrtf; charset=\"us-ascii\""); + i += aim_puttlv_str(newpacket->data+i, 0x0001, strlen("text/aolrtf; charset=\"us-ascii\""), "text/x-aolrtf; charset=\"us-ascii\""); i += aim_puttlv_str(newpacket->data+i, 0x0002, strlen(profile), profile); /* why do we send this twice? */ - i += aim_puttlv_str(newpacket->data+i, 0x0003, strlen("text/x-aolrtf; charset=\"us-ascii\""), "text/x-aolrtf; charset=\"us-ascii\""); + i += aim_puttlv_str(newpacket->data+i, 0x0003, strlen("text/aolrtf; charset=\"us-ascii\""), "text/x-aolrtf; charset=\"us-ascii\""); /* Away message -- we send this no matter what, even if its blank */ if (awaymsg) @@ -361,7 +361,7 @@ faim_export unsigned long aim_setversions(struct aim_session_t *sess, struct command_tx_struct *newpacket; int i; - if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10 + (4*12)))) + if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10 + (4*16)))) return -1; newpacket->lock = 1; @@ -372,9 +372,6 @@ faim_export unsigned long aim_setversions(struct aim_session_t *sess, i += aimutil_put16(newpacket->data+i, 0x0001); i += aimutil_put16(newpacket->data+i, 0x0003); - i += aimutil_put16(newpacket->data+i, 0x0013); - i += aimutil_put16(newpacket->data+i, 0x0001); - i += aimutil_put16(newpacket->data+i, 0x0002); i += aimutil_put16(newpacket->data+i, 0x0001); @@ -397,11 +394,17 @@ faim_export unsigned long aim_setversions(struct aim_session_t *sess, i += aimutil_put16(newpacket->data+i, 0x0001); i += aimutil_put16(newpacket->data+i, 0x000b); - i += aimutil_put16(newpacket->data+i, 0x0001); + i += aimutil_put16(newpacket->data+i, 0x0002); i += aimutil_put16(newpacket->data+i, 0x000c); i += aimutil_put16(newpacket->data+i, 0x0001); + i += aimutil_put16(newpacket->data+i, 0x0013); + i += aimutil_put16(newpacket->data+i, 0x0001); + + i += aimutil_put16(newpacket->data+i, 0x0015); + i += aimutil_put16(newpacket->data+i, 0x0001); + newpacket->commandlen = i; newpacket->lock = 0; aim_tx_enqueue(sess, newpacket); diff --git a/utils/faimtest/faimtest.c b/utils/faimtest/faimtest.c index 96d993d..2875afc 100644 --- a/utils/faimtest/faimtest.c +++ b/utils/faimtest/faimtest.c @@ -466,7 +466,7 @@ int faimtest_rateresp(struct aim_session_t *sess, struct command_rx_struct *comm aim_bos_ackrateresp(sess, command->conn); /* ack rate info response */ aim_bos_reqpersonalinfo(sess, command->conn); aim_bos_reqlocaterights(sess, command->conn); - aim_bos_setprofile(sess, command->conn, profile, NULL, AIM_CAPS_BUDDYICON | AIM_CAPS_CHAT | AIM_CAPS_VOICE | AIM_CAPS_GETFILE | AIM_CAPS_SENDFILE | AIM_CAPS_IMIMAGE | AIM_CAPS_GAMES | AIM_CAPS_SAVESTOCKS); + aim_bos_setprofile(sess, command->conn, profile, NULL, AIM_CAPS_BUDDYICON | AIM_CAPS_CHAT | AIM_CAPS_VOICE | AIM_CAPS_GETFILE | AIM_CAPS_SENDFILE | AIM_CAPS_IMIMAGE /*| AIM_CAPS_GAMES | AIM_CAPS_SAVESTOCKS*/); aim_bos_reqbuddyrights(sess, command->conn); /* send the buddy list and profile (required, even if empty) */ @@ -479,7 +479,7 @@ int faimtest_rateresp(struct aim_session_t *sess, struct command_rx_struct *comm aim_bos_reqrights(sess, command->conn); /* set group permissions -- all user classes */ aim_bos_setgroupperm(sess, command->conn, AIM_FLAG_ALLUSERS); - aim_bos_setprivacyflags(sess, command->conn, AIM_PRIVFLAGS_ALLOWIDLE|AIM_PRIVFLAGS_ALLOWMEMBERSINCE); + aim_bos_setprivacyflags(sess, command->conn, AIM_PRIVFLAGS_ALLOWIDLE); break; } @@ -693,98 +693,91 @@ int faimtest_handleredirect(struct aim_session_t *sess, struct command_rx_struct ip = va_arg(ap, char *); cookie = va_arg(ap, unsigned char *); - switch(serviceid) - { - case 0x0005: /* Adverts */ - { - struct aim_conn_t *tstconn; + switch(serviceid) { + case 0x0005: { /* Adverts */ + struct aim_conn_t *tstconn; - tstconn = aim_newconn(sess, AIM_CONN_TYPE_ADS, ip); - if ((tstconn==NULL) || (tstconn->status & AIM_CONN_STATUS_RESOLVERR)) { - dprintf("faimtest: unable to reconnect with authorizer\n"); - } else { - aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, faimtest_flapversion, 0); - aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); - aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, faimtest_serverready, 0); - aim_conn_addhandler(sess, tstconn, 0x0001, 0x0007, faimtest_rateresp, 0); /* rate info */ - aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_GEN, 0x0018, faimtest_hostversions, 0); - aim_auth_sendcookie(sess, tstconn, cookie); - dprintf("sent cookie to adverts host\n"); - } + tstconn = aim_newconn(sess, AIM_CONN_TYPE_ADS, ip); + if ((tstconn==NULL) || (tstconn->status & AIM_CONN_STATUS_RESOLVERR)) { + dprintf("faimtest: unable to reconnect with authorizer\n"); + } else { + aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, faimtest_flapversion, 0); + aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); + aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, faimtest_serverready, 0); + aim_conn_addhandler(sess, tstconn, 0x0001, 0x0007, faimtest_rateresp, 0); /* rate info */ + aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_GEN, 0x0018, faimtest_hostversions, 0); + aim_auth_sendcookie(sess, tstconn, cookie); + dprintf("sent cookie to adverts host\n"); + } + break; + } + case 0x0007: { /* Authorizer */ + struct aim_conn_t *tstconn; + /* Open a connection to the Auth */ + tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, ip); + if ((tstconn==NULL) || (tstconn->status & AIM_CONN_STATUS_RESOLVERR)) { + dprintf("faimtest: unable to reconnect with authorizer\n"); + } else { + aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, faimtest_flapversion, 0); + aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); + aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, faimtest_serverready, 0); + aim_conn_addhandler(sess, tstconn, 0x0001, 0x0007, faimtest_rateresp, 0); /* rate info */ + aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_GEN, 0x0018, faimtest_hostversions, 0); + aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, faimtest_accountconfirm, 0); + aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, faimtest_infochange, 0); + aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, faimtest_infochange, 0); + /* Send the cookie to the Auth */ + aim_auth_sendcookie(sess, tstconn, cookie); + dprintf("sent cookie to authorizer host\n"); + } + break; + } + case 0x000d: { /* ChatNav */ + struct aim_conn_t *tstconn = NULL; + tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, ip); + if ( (tstconn==NULL) || (tstconn->status & AIM_CONN_STATUS_RESOLVERR)) { + dprintf("faimtest: unable to connect to chatnav server\n"); + if (tstconn) aim_conn_kill(sess, &tstconn); + return 1; + } - } - break; - case 0x0007: /* Authorizer */ - { - struct aim_conn_t *tstconn; - /* Open a connection to the Auth */ - tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, ip); - if ((tstconn==NULL) || (tstconn->status & AIM_CONN_STATUS_RESOLVERR)) { - dprintf("faimtest: unable to reconnect with authorizer\n"); - } else { - aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, faimtest_flapversion, 0); - aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); - aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, faimtest_serverready, 0); - aim_conn_addhandler(sess, tstconn, 0x0001, 0x0007, faimtest_rateresp, 0); /* rate info */ - aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_GEN, 0x0018, faimtest_hostversions, 0); - aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, faimtest_accountconfirm, 0); - aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, faimtest_infochange, 0); - aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, faimtest_infochange, 0); - /* Send the cookie to the Auth */ - aim_auth_sendcookie(sess, tstconn, cookie); - dprintf("sent cookie to authorizer host\n"); - } + aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, faimtest_serverready, 0); + aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); + aim_auth_sendcookie(sess, tstconn, cookie); + dprintf("\achatnav: connected\n"); + break; + } + case 0x000e: { /* Chat */ + char *roomname = NULL; + int exchange; + struct aim_conn_t *tstconn = NULL; - } - break; - case 0x000d: /* ChatNav */ - { - struct aim_conn_t *tstconn = NULL; - tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, ip); - if ( (tstconn==NULL) || (tstconn->status & AIM_CONN_STATUS_RESOLVERR)) { - dprintf("faimtest: unable to connect to chatnav server\n"); - if (tstconn) aim_conn_kill(sess, &tstconn); - return 1; - } + roomname = va_arg(ap, char *); + exchange = va_arg(ap, int); - aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, faimtest_serverready, 0); - aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); - aim_auth_sendcookie(sess, tstconn, cookie); - dprintf("\achatnav: connected\n"); - } - break; - case 0x000e: /* Chat */ - { - char *roomname = NULL; - int exchange; - struct aim_conn_t *tstconn = NULL; - - roomname = va_arg(ap, char *); - exchange = va_arg(ap, int); - - tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, ip); - if ( (tstconn==NULL) || (tstconn->status & AIM_CONN_STATUS_RESOLVERR)) - { - dprintf("faimtest: unable to connect to chat server\n"); - if (tstconn) aim_conn_kill(sess, &tstconn); - return 1; - } - dvprintf("faimtest: chat: connected to %s on exchange %d\n", roomname, exchange); - - /* - * We must do this to attach the stored name to the connection! - */ - aim_chat_attachname(tstconn, roomname); - - aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, faimtest_serverready, 0); - aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); - aim_auth_sendcookie(sess, tstconn, cookie); - } - break; - default: - dvprintf("uh oh... got redirect for unknown service 0x%04x!!\n", serviceid); - /* dunno */ - } + tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, ip); + if ( (tstconn==NULL) || (tstconn->status & AIM_CONN_STATUS_RESOLVERR)) { + dprintf("faimtest: unable to connect to chat server\n"); + if (tstconn) aim_conn_kill(sess, &tstconn); + return 1; + } + dvprintf("faimtest: chat: connected to %s on exchange %d\n", roomname, exchange); + + /* + * We must do this to attach the stored name to the connection! + */ + aim_chat_attachname(tstconn, roomname); + + aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, faimtest_serverready, 0); + aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE, faimtest_conncomplete, 0); + aim_auth_sendcookie(sess, tstconn, cookie); + + break; + } + default: + dvprintf("uh oh... got redirect for unknown service 0x%04x!!\n", serviceid); + /* dunno */ + } va_end(ap); @@ -1516,6 +1509,19 @@ int faimtest_parse_motd(struct aim_session_t *sess, struct command_rx_struct *co if (!connected) connected++; +#if 0 + aim_bos_reqservice(sess, command->conn, 0x0005); /* adverts */ + aim_bos_reqservice(sess, command->conn, 0x000f); /* user directory */ + + /* Don't know what this does... */ + /* XXX sess->sn should be normalized by the 0001/000f handler */ + aim_0002_000b(sess, command->conn, sess->sn); +#endif + + /* As of 26 Mar 2001 you need to send this to keep from getting kicked off */ + aim_0001_0020(sess, command->conn); + + return 1; }