pidgin/pidgin

Parents 6b0e0566af20
Children 852014ae74a0
Gadu-Gadu: disable password change and account registration. Fixes the crash when trying to register new account. Both functions will probably been reimplemented in 3.0.0
--- a/ChangeLog Thu Jan 16 12:11:19 2014 +0100
+++ b/ChangeLog Thu Jan 16 13:02:42 2014 +0100
@@ -51,6 +51,9 @@
(CVE-2013-6487)
* Disabled buddy list import/export from/to server (it didn't work
anymore). Buddy list synchronization will be implemented in 3.0.0.
+ * Disabled new account registration and password change options, as it
+ didn't work either. Account registration also caused a crash. Both
+ functions are available using official Gadu-Gadu website.
IRC:
* Fix bug where initial IRC status would not be set correctly.
--- a/libpurple/protocols/gg/gg.c Thu Jan 16 12:11:19 2014 +0100
+++ b/libpurple/protocols/gg/gg.c Thu Jan 16 13:02:42 2014 +0100
@@ -109,96 +109,6 @@
return 0;
}
-static void ggp_async_token_handler(gpointer _gc, gint fd, PurpleInputCondition cond)
-{
- PurpleConnection *gc = _gc;
- GGPInfo *info = gc->proto_data;
- GGPToken *token = info->token;
- GGPTokenCallback cb;
-
- struct gg_token *t = NULL;
-
- purple_debug_info("gg", "token_handler: token->req: check = %d; state = %d;\n",
- token->req->check, token->req->state);
-
- if (gg_token_watch_fd(token->req) == -1 || token->req->state == GG_STATE_ERROR) {
- purple_debug_error("gg", "token error (1): %d\n", token->req->error);
- purple_input_remove(token->inpa);
- gg_token_free(token->req);
- token->req = NULL;
-
- purple_notify_error(purple_connection_get_account(gc),
- _("Token Error"),
- _("Unable to fetch the token.\n"), NULL);
- return;
- }
-
- if (token->req->state != GG_STATE_DONE) {
- purple_input_remove(token->inpa);
- token->inpa = purple_input_add(token->req->fd,
- ggp_tcpsocket_inputcond_gg_to_purple(token->req->check),
- ggp_async_token_handler, gc);
- return;
- }
-
- if (!(t = token->req->data) || !token->req->body) {
- purple_debug_error("gg", "token error (2): %d\n", token->req->error);
- purple_input_remove(token->inpa);
- gg_token_free(token->req);
- token->req = NULL;
-
- purple_notify_error(purple_connection_get_account(gc),
- _("Token Error"),
- _("Unable to fetch the token.\n"), NULL);
- return;
- }
-
- purple_input_remove(token->inpa);
-
- token->id = g_strdup(t->tokenid);
- token->size = token->req->body_size;
- token->data = g_new0(char, token->size);
- memcpy(token->data, token->req->body, token->size);
-
- purple_debug_info("gg", "TOKEN! tokenid = %s; size = %d\n",
- token->id, token->size);
-
- gg_token_free(token->req);
- token->req = NULL;
- token->inpa = 0;
-
- cb = token->cb;
- token->cb = NULL;
- cb(gc);
-}
-
-static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb)
-{
- PurpleAccount *account;
- struct gg_http *req;
- GGPInfo *info;
-
- account = purple_connection_get_account(gc);
-
- if (ggp_setup_proxy(account) == -1)
- return;
-
- info = gc->proto_data;
-
- if ((req = gg_token(1)) == NULL) {
- purple_notify_error(account,
- _("Token Error"),
- _("Unable to fetch the token.\n"), NULL);
- return;
- }
-
- info->token = g_new(GGPToken, 1);
- info->token->cb = cb;
-
- info->token->req = req;
- info->token->inpa = purple_input_add(req->fd, PURPLE_INPUT_READ,
- ggp_async_token_handler, gc);
-}
/* }}} */
/* ---------------------------------------------------------------------- */
@@ -291,155 +201,6 @@
gc);
}
-static void ggp_callback_register_account_ok(PurpleConnection *gc,
- PurpleRequestFields *fields)
-{
- PurpleAccount *account;
- GGPInfo *info = gc->proto_data;
- struct gg_http *h = NULL;
- struct gg_pubdir *s;
- uin_t uin;
- gchar *email, *p1, *p2, *t;
- GGPToken *token = info->token;
-
- email = charset_convert(purple_request_fields_get_string(fields, "email"),
- "UTF-8", "CP1250");
- p1 = charset_convert(purple_request_fields_get_string(fields, "password1"),
- "UTF-8", "CP1250");
- p2 = charset_convert(purple_request_fields_get_string(fields, "password2"),
- "UTF-8", "CP1250");
- t = charset_convert(purple_request_fields_get_string(fields, "token"),
- "UTF-8", "CP1250");
-
- account = purple_connection_get_account(gc);
-
- if (email == NULL || p1 == NULL || p2 == NULL || t == NULL ||
- *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') {
- purple_connection_error_reason (gc,
- PURPLE_CONNECTION_ERROR_OTHER_ERROR,
- _("You must fill in all registration fields"));
- goto exit_err;
- }
-
- if (g_utf8_collate(p1, p2) != 0) {
- purple_connection_error_reason (gc,
- PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
- _("Passwords do not match"));
- goto exit_err;
- }
-
- purple_debug_info("gg", "register_account_ok: token_id = %s; t = %s\n",
- token->id, t);
- h = gg_register3(email, p1, token->id, t, 0);
- if (h == NULL || !(s = h->data) || !s->success) {
- purple_connection_error_reason (gc,
- PURPLE_CONNECTION_ERROR_OTHER_ERROR,
- _("Unable to register new account. An unknown error occurred."));
- goto exit_err;
- }
-
- uin = s->uin;
- purple_debug_info("gg", "registered uin: %d\n", uin);
-
- g_free(t);
- t = g_strdup_printf("%u", uin);
- purple_account_set_username(account, t);
- /* Save the password if remembering passwords for the account */
- purple_account_set_password(account, p1);
-
- purple_notify_info(NULL, _("New Gadu-Gadu Account Registered"),
- _("Registration completed successfully!"), NULL);
-
- if(account->registration_cb)
- (account->registration_cb)(account, TRUE, account->registration_cb_user_data);
- /* TODO: the currently open Accounts Window will not be updated withthe
- * new username and etc, we need to somehow have it refresh at this
- * point
- */
-
- /* Need to disconnect or actually log in. For now, we disconnect. */
- purple_account_disconnect(account);
-
-exit_err:
- if(account->registration_cb)
- (account->registration_cb)(account, FALSE, account->registration_cb_user_data);
-
- gg_register_free(h);
- g_free(email);
- g_free(p1);
- g_free(p2);
- g_free(t);
- g_free(token->id);
- g_free(token);
-}
-
-static void ggp_callback_register_account_cancel(PurpleConnection *gc,
- PurpleRequestFields *fields)
-{
- GGPInfo *info = gc->proto_data;
- GGPToken *token = info->token;
-
- purple_account_disconnect(gc->account);
-
- g_free(token->id);
- g_free(token->data);
- g_free(token);
-
-}
-
-static void ggp_register_user_dialog(PurpleConnection *gc)
-{
- PurpleAccount *account;
- PurpleRequestFields *fields;
- PurpleRequestFieldGroup *group;
- PurpleRequestField *field;
-
- GGPInfo *info = gc->proto_data;
- GGPToken *token = info->token;
-
-
- account = purple_connection_get_account(gc);
-
- fields = purple_request_fields_new();
- group = purple_request_field_group_new(NULL);
- purple_request_fields_add_group(fields, group);
-
- field = purple_request_field_string_new("email",
- _("Email"), "", FALSE);
- purple_request_field_string_set_masked(field, FALSE);
- purple_request_field_group_add_field(group, field);
-
- field = purple_request_field_string_new("password1",
- _("Password"), "", FALSE);
- purple_request_field_string_set_masked(field, TRUE);
- purple_request_field_group_add_field(group, field);
-
- field = purple_request_field_string_new("password2",
- _("Password (again)"), "", FALSE);
- purple_request_field_string_set_masked(field, TRUE);
- purple_request_field_group_add_field(group, field);
-
- field = purple_request_field_string_new("token",
- _("Enter captcha text"), "", FALSE);
- purple_request_field_string_set_masked(field, FALSE);
- purple_request_field_group_add_field(group, field);
-
- /* original size: 60x24 */
- field = purple_request_field_image_new("token_img",
- _("Captcha"), token->data, token->size);
- purple_request_field_group_add_field(group, field);
-
- purple_request_fields(account,
- _("Register New Gadu-Gadu Account"),
- _("Register New Gadu-Gadu Account"),
- _("Please, fill in the following fields"),
- fields,
- _("OK"), G_CALLBACK(ggp_callback_register_account_ok),
- _("Cancel"), G_CALLBACK(ggp_callback_register_account_cancel),
- purple_connection_get_account(gc), NULL, NULL,
- gc);
-}
-
/* ----- PUBLIC DIRECTORY SEARCH ---------------------------------------- */
static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data)
@@ -577,144 +338,6 @@
gc);
}
-/* ----- CHANGE PASSWORD ------------------------------------------------ */
-
-static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields)
-{
- PurpleAccount *account;
- GGPInfo *info = gc->proto_data;
- struct gg_http *h;
- gchar *cur, *p1, *p2, *t;
-
- cur = charset_convert(
- purple_request_fields_get_string(fields, "password_cur"),
- "UTF-8", "CP1250");
- p1 = charset_convert(
- purple_request_fields_get_string(fields, "password1"),
- "UTF-8", "CP1250");
- p2 = charset_convert(
- purple_request_fields_get_string(fields, "password2"),
- "UTF-8", "CP1250");
- t = charset_convert(
- purple_request_fields_get_string(fields, "token"),
- "UTF-8", "CP1250");
-
- account = purple_connection_get_account(gc);
-
- if (cur == NULL || p1 == NULL || p2 == NULL || t == NULL ||
- *cur == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') {
- purple_notify_error(account, NULL, _("Fill in the fields."), NULL);
- goto exit_err;
- }
-
- if (g_utf8_collate(p1, p2) != 0) {
- purple_notify_error(account, NULL,
- _("New passwords do not match."), NULL);
- goto exit_err;
- }
-
- if (g_utf8_collate(cur, purple_account_get_password(account)) != 0) {
- purple_notify_error(account, NULL,
- _("Your current password is different from the one that you specified."),
- NULL);
- goto exit_err;
- }
-
- purple_debug_info("gg", "Changing password\n");
-
- /* XXX: this email should be a pref... */
- h = gg_change_passwd4(ggp_get_uin(account),
- "user@example.net", purple_account_get_password(account),
- p1, info->token->id, t, 0);
-
- if (h == NULL) {
- purple_notify_error(account, NULL,
- _("Unable to change password. Error occurred.\n"),
- NULL);
- goto exit_err;
- }
-
- purple_account_set_password(account, p1);
-
- gg_change_passwd_free(h);
-
- purple_notify_info(account, _("Change password for the Gadu-Gadu account"),
- _("Password was changed successfully!"), NULL);
-
-exit_err:
- g_free(cur);
- g_free(p1);
- g_free(p2);
- g_free(t);
- g_free(info->token->id);
- g_free(info->token->data);
- g_free(info->token);
-}
-
-static void ggp_change_passwd_dialog(PurpleConnection *gc)
-{
- PurpleRequestFields *fields;
- PurpleRequestFieldGroup *group;
- PurpleRequestField *field;
-
- GGPInfo *info = gc->proto_data;
- GGPToken *token = info->token;
-
- char *msg;
-
-
- fields = purple_request_fields_new();
- group = purple_request_field_group_new(NULL);
- purple_request_fields_add_group(fields, group);
-
- field = purple_request_field_string_new("password_cur",
- _("Current password"), "", FALSE);
- purple_request_field_string_set_masked(field, TRUE);
- purple_request_field_group_add_field(group, field);
-
- field = purple_request_field_string_new("password1",
- _("Password"), "", FALSE);
- purple_request_field_string_set_masked(field, TRUE);
- purple_request_field_group_add_field(group, field);
-
- field = purple_request_field_string_new("password2",
- _("Password (retype)"), "", FALSE);
- purple_request_field_string_set_masked(field, TRUE);
- purple_request_field_group_add_field(group, field);
-
- field = purple_request_field_string_new("token",
- _("Enter current token"), "", FALSE);
- purple_request_field_string_set_masked(field, FALSE);
- purple_request_field_group_add_field(group, field);
-
- /* original size: 60x24 */
- field = purple_request_field_image_new("token_img",
- _("Current token"), token->data, token->size);
- purple_request_field_group_add_field(group, field);
-
- msg = g_strdup_printf("%s %d",
- _("Please, enter your current password and your new password for UIN: "),
- ggp_get_uin(purple_connection_get_account(gc)));
-
- purple_request_fields(gc,
- _("Change Gadu-Gadu Password"),
- _("Change Gadu-Gadu Password"),
- msg,
- fields, _("OK"), G_CALLBACK(ggp_callback_change_passwd_ok),
- _("Cancel"), NULL,
- purple_connection_get_account(gc), NULL, NULL,
- gc);
-
- g_free(msg);
-}
-
-static void ggp_change_passwd(PurplePluginAction *action)
-{
- PurpleConnection *gc = (PurpleConnection *)action->context;
-
- ggp_token_request(gc, ggp_change_passwd_dialog);
-}
-
/* ----- CHANGE STATUS BROADCASTING ------------------------------------------------ */
static void ggp_action_change_status_broadcasting_ok(PurpleConnection *gc, PurpleRequestFields *fields)
@@ -2548,13 +2171,6 @@
}
}
-static void ggp_register_user(PurpleAccount *account)
-{
- PurpleConnection *gc = purple_account_get_connection(account);
-
- ggp_token_request(gc, ggp_register_user_dialog);
-}
-
static GList *ggp_actions(PurplePlugin *plugin, gpointer context)
{
GList *m = NULL;
@@ -2564,10 +2180,8 @@
ggp_find_buddies);
m = g_list_append(m, act);
- m = g_list_append(m, NULL);
-
- act = purple_plugin_action_new(_("Change password..."),
- ggp_change_passwd);
+ act = purple_plugin_action_new(_("Change status broadcasting"),
+ ggp_action_change_status_broadcasting);
m = g_list_append(m, act);
m = g_list_append(m, NULL);
@@ -2580,10 +2194,6 @@
ggp_action_buddylist_load);
m = g_list_append(m, act);
- act = purple_plugin_action_new(_("Change status broadcasting"),
- ggp_action_change_status_broadcasting);
- m = g_list_append(m, act);
-
return m;
}
@@ -2594,7 +2204,7 @@
static PurplePluginProtocolInfo prpl_info =
{
- OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE,
+ OPT_PROTO_IM_IMAGE,
NULL, /* user_splits */
NULL, /* protocol_options */
{"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
@@ -2632,7 +2242,7 @@
NULL, /* chat_whisper */
ggp_chat_send, /* chat_send */
ggp_keepalive, /* keepalive */
- ggp_register_user, /* register_user */
+ NULL, /* register_user */
NULL, /* get_cb_info */
NULL, /* get_cb_away */
NULL, /* alias_buddy */