Mercurial > pidgin
comparison libpurple/protocols/oscar/oscar.c @ 32774:069919a0896c
Validate utf8 for a few random strings that we read, in case AOL or ICQ
decide to start sending us non-utf8
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 03 May 2012 09:28:11 +0000 |
parents | 28b741b2fc1d |
children |
comparison
equal
deleted
inserted
replaced
32773:4d33c1b30788 | 32774:069919a0896c |
---|---|
53 #include "oscar.h" | 53 #include "oscar.h" |
54 #include "peer.h" | 54 #include "peer.h" |
55 | 55 |
56 #define AIMHASHDATA "http://pidgin.im/aim_data.php3" | 56 #define AIMHASHDATA "http://pidgin.im/aim_data.php3" |
57 | 57 |
58 #define OSCAR_CONNECT_STEPS 6 | |
59 | |
60 static guint64 purple_caps = | 58 static guint64 purple_caps = |
61 OSCAR_CAPABILITY_CHAT | 59 OSCAR_CAPABILITY_CHAT |
62 | OSCAR_CAPABILITY_BUDDYICON | 60 | OSCAR_CAPABILITY_BUDDYICON |
63 | OSCAR_CAPABILITY_DIRECTIM | 61 | OSCAR_CAPABILITY_DIRECTIM |
64 | OSCAR_CAPABILITY_SENDFILE | 62 | OSCAR_CAPABILITY_SENDFILE |
87 | 85 |
88 /* All the libfaim->purple callback functions */ | 86 /* All the libfaim->purple callback functions */ |
89 | 87 |
90 /* Only used when connecting with the old-style BUCP login */ | 88 /* Only used when connecting with the old-style BUCP login */ |
91 static int purple_parse_auth_resp (OscarData *, FlapConnection *, FlapFrame *, ...); | 89 static int purple_parse_auth_resp (OscarData *, FlapConnection *, FlapFrame *, ...); |
92 static int purple_parse_login (OscarData *, FlapConnection *, FlapFrame *, ...); | |
93 static int purple_parse_auth_securid_request(OscarData *, FlapConnection *, FlapFrame *, ...); | 90 static int purple_parse_auth_securid_request(OscarData *, FlapConnection *, FlapFrame *, ...); |
94 | 91 |
95 static int purple_handle_redirect (OscarData *, FlapConnection *, FlapFrame *, ...); | 92 static int purple_handle_redirect (OscarData *, FlapConnection *, FlapFrame *, ...); |
96 static int purple_info_change (OscarData *, FlapConnection *, FlapFrame *, ...); | 93 static int purple_info_change (OscarData *, FlapConnection *, FlapFrame *, ...); |
97 static int purple_account_confirm (OscarData *, FlapConnection *, FlapFrame *, ...); | 94 static int purple_account_confirm (OscarData *, FlapConnection *, FlapFrame *, ...); |
671 oscar_data_addhandler(od, SNAC_FAMILY_ALERT, 0x0001, purple_parse_genericerr, 0); | 668 oscar_data_addhandler(od, SNAC_FAMILY_ALERT, 0x0001, purple_parse_genericerr, 0); |
672 oscar_data_addhandler(od, SNAC_FAMILY_ALERT, SNAC_SUBTYPE_ALERT_MAILSTATUS, purple_email_parseupdate, 0); | 669 oscar_data_addhandler(od, SNAC_FAMILY_ALERT, SNAC_SUBTYPE_ALERT_MAILSTATUS, purple_email_parseupdate, 0); |
673 | 670 |
674 /* These are only needed when connecting with the old-style BUCP login */ | 671 /* These are only needed when connecting with the old-style BUCP login */ |
675 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0003, purple_parse_auth_resp, 0); | 672 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0003, purple_parse_auth_resp, 0); |
676 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0007, purple_parse_login, 0); | |
677 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_REQUEST, purple_parse_auth_securid_request, 0); | 673 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_REQUEST, purple_parse_auth_securid_request, 0); |
678 | 674 |
679 oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_RESPONSE, purple_icon_parseicon, 0); | 675 oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_RESPONSE, purple_icon_parseicon, 0); |
680 oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0001, purple_parse_genericerr, 0); | 676 oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0001, purple_parse_genericerr, 0); |
681 oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0003, purple_bosrights, 0); | 677 oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0003, purple_bosrights, 0); |
1226 _("_OK"), G_CALLBACK(purple_parse_auth_securid_request_yes_cb), | 1222 _("_OK"), G_CALLBACK(purple_parse_auth_securid_request_yes_cb), |
1227 _("_Cancel"), G_CALLBACK(purple_parse_auth_securid_request_no_cb), | 1223 _("_Cancel"), G_CALLBACK(purple_parse_auth_securid_request_no_cb), |
1228 account, NULL, NULL, | 1224 account, NULL, NULL, |
1229 gc); | 1225 gc); |
1230 g_free(primary); | 1226 g_free(primary); |
1231 | |
1232 return 1; | |
1233 } | |
1234 | |
1235 /** | |
1236 * Only used when connecting with the old-style BUCP login. | |
1237 */ | |
1238 static int | |
1239 purple_parse_login(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) | |
1240 { | |
1241 PurpleConnection *gc; | |
1242 PurpleAccount *account; | |
1243 ClientInfo aiminfo = CLIENTINFO_PURPLE_AIM; | |
1244 ClientInfo icqinfo = CLIENTINFO_PURPLE_ICQ; | |
1245 va_list ap; | |
1246 char *key; | |
1247 gboolean truncate_pass; | |
1248 | |
1249 gc = od->gc; | |
1250 account = purple_connection_get_account(gc); | |
1251 | |
1252 va_start(ap, fr); | |
1253 key = va_arg(ap, char *); | |
1254 truncate_pass = va_arg(ap, int); | |
1255 va_end(ap); | |
1256 | |
1257 aim_send_login(od, conn, purple_account_get_username(account), | |
1258 purple_connection_get_password(gc), truncate_pass, | |
1259 od->icq ? &icqinfo : &aiminfo, key, | |
1260 purple_account_get_bool(account, "allow_multiple_logins", OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS)); | |
1261 | |
1262 purple_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); | |
1263 | 1227 |
1264 return 1; | 1228 return 1; |
1265 } | 1229 } |
1266 | 1230 |
1267 static int | 1231 static int |