Mon, 31 Oct 2011 06:32:01 +0000
Remove the silly destroy argument from purple_account_set_password and
purple_keyring_set_password. Make the password argument const. All
code paths would free the password immediately, anyway. Except maybe
the KWallet plugin, but that really appears totally broken, to be
honest.
--- a/finch/gntaccount.c Mon Oct 31 03:11:52 2011 +0000 +++ b/finch/gntaccount.c Mon Oct 31 06:32:01 2011 +0000 @@ -199,9 +199,9 @@ gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->remember))); value = gnt_entry_get_text(GNT_ENTRY(dialog->password)); if (value && *value) - purple_account_set_password(account, g_strdup(value), g_free, NULL, NULL); + purple_account_set_password(account, value, NULL, NULL); else - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); /* Mail notification */ purple_account_set_check_mail(account,
--- a/libpurple/account.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/account.c Mon Oct 31 06:32:01 2011 +0000 @@ -1249,12 +1249,12 @@ } if (!remember) - purple_keyring_set_password(account, NULL, NULL, NULL, NULL); + purple_keyring_set_password(account, NULL, NULL, NULL); purple_account_set_remember_password(account, remember); password = g_strdup(entry); - purple_account_set_password(account, password, NULL, NULL, NULL); + purple_account_set_password(account, password, NULL, NULL); g_free(password); _purple_connection_new(account, FALSE, entry); @@ -1738,8 +1738,7 @@ void purple_account_set_password(PurpleAccount *account, - gchar *password, - GDestroyNotify destroy, + const gchar *password, PurpleKeyringSaveCallback cb, gpointer data) { @@ -1766,8 +1765,7 @@ cb(account, NULL, data); } else { - purple_keyring_set_password(account, password, - destroy, cb, data); + purple_keyring_set_password(account, password, cb, data); } } @@ -2848,7 +2846,7 @@ PurpleConnection *gc = purple_account_get_connection(account); PurplePlugin *prpl = NULL; - purple_account_set_password(account, g_strdup(new_pw), g_free, NULL, NULL); + purple_account_set_password(account, new_pw, NULL, NULL); if (gc != NULL) prpl = purple_connection_get_prpl(gc); @@ -3072,7 +3070,7 @@ /* this is async because we do not want the * account overwritten before we are done. */ - purple_keyring_set_password(account, NULL, NULL, + purple_keyring_set_password(account, NULL, purple_accounts_delete_finish, NULL); }
--- a/libpurple/account.h Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/account.h Mon Oct 31 06:32:01 2011 +0000 @@ -354,13 +354,11 @@ * * @param account The account for which the password is to be saved. * @param password The password to save. - * @param destroy A function called to free the password. Can be NULL. * @param cb A callback for once the password is saved. * @param data A pointer to be passed to the callback. */ void purple_account_set_password(PurpleAccount *account, - gchar *password, - GDestroyNotify destroy, + const gchar *password, PurpleKeyringSaveCallback cb, gpointer data);
--- a/libpurple/example/nullclient.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/example/nullclient.c Mon Oct 31 06:32:01 2011 +0000 @@ -305,7 +305,7 @@ /* Get the password for the account */ password = getpass("Password: "); - purple_account_set_password(account, g_strdup(password), g_free, NULL, NULL); + purple_account_set_password(account, password, NULL, NULL); /* It's necessary to enable the account first. */ purple_account_set_enabled(account, UI_ID, TRUE);
--- a/libpurple/keyring.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/keyring.c Mon Oct 31 06:32:01 2011 +0000 @@ -359,7 +359,7 @@ for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) - save(cur->data, NULL, NULL, NULL, NULL); + save(cur->data, NULL, NULL, NULL); return; } @@ -467,7 +467,7 @@ * schedule_accounts_save() function, but other such functions * are not exposed. So these was done for consistency. */ - purple_account_set_password(NULL, NULL, NULL, NULL, NULL); + purple_account_set_password(NULL, NULL, NULL, NULL); return; } @@ -513,7 +513,7 @@ * in having a keyring that can't store passwords, but it * will prevent crash with invalid keyrings */ - save(account, password, NULL, + save(account, password, purple_keyring_set_inuse_check_error_cb, tracker); } else { @@ -919,8 +919,7 @@ void purple_keyring_set_password(PurpleAccount * account, - gchar *password, - GDestroyNotify destroy, + const gchar *password, PurpleKeyringSaveCallback cb, gpointer data) { @@ -952,8 +951,7 @@ cbinfo = g_malloc(sizeof(PurpleKeyringCbInfo)); cbinfo->cb = cb; cbinfo->data = data; - save(account, password, destroy, - purple_keyring_set_password_async_cb, data); + save(account, password, purple_keyring_set_password_async_cb, data); } } return;
--- a/libpurple/keyring.h Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/keyring.h Mon Oct 31 06:32:01 2011 +0000 @@ -131,13 +131,11 @@ * the function returns, so one must take care to make a copy if they call other * async functions later. If the password is NULL, this means that the keyring * should forget about that password. - * @param destroypassword A function that will be called to free the password. * @param cb A callback to be called once the password is saved. * @param data A pointer to be passed to the callback */ typedef void (*PurpleKeyringSave)(PurpleAccount * account, - gchar * password, - GDestroyNotify destroypassword, + const gchar * password, PurpleKeyringSaveCallback cb, gpointer data); @@ -326,14 +324,12 @@ * * @param account The account for which the password is to be saved. * @param password The password to save. - * @param destroy A function called to free the password. Can be NULL. * @param cb A callback for once the password is saved. * @param data A pointer to be passed to the callback. */ void purple_keyring_set_password(PurpleAccount *account, - gchar *password, - GDestroyNotify destroy, + const gchar *password, PurpleKeyringSaveCallback cb, gpointer data);
--- a/libpurple/plugins/keyrings/gnomekeyring.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/plugins/keyrings/gnomekeyring.c Mon Oct 31 06:32:01 2011 +0000 @@ -80,7 +80,7 @@ static GQuark gkp_error_domain(void); static void gkp_read(PurpleAccount *, PurpleKeyringReadCallback, gpointer); static void gkp_read_continue(GnomeKeyringResult, const char *, gpointer); -static void gkp_save(PurpleAccount *, gchar *, GDestroyNotify, PurpleKeyringSaveCallback, gpointer); +static void gkp_save(PurpleAccount *, const gchar *, PurpleKeyringSaveCallback, gpointer); static void gkp_save_continue(GnomeKeyringResult, gpointer); static void gkp_close(GError **); static gboolean gkp_import_password(PurpleAccount *, const char *, const char *, GError **); @@ -180,8 +180,7 @@ static void gkp_save(PurpleAccount * account, - gchar * password, - GDestroyNotify destroy, + const gchar * password, PurpleKeyringSaveCallback cb, gpointer data) { @@ -210,9 +209,6 @@ "user", purple_account_get_username(account), "protocol", purple_account_get_protocol_id(account), NULL); - - if (destroy) - destroy(password); } else { /* password == NULL, delete password. */
--- a/libpurple/plugins/keyrings/internalkeyring.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/plugins/keyrings/internalkeyring.c Mon Oct 31 06:32:01 2011 +0000 @@ -74,7 +74,7 @@ /* a few prototypes : */ static void internal_keyring_read(PurpleAccount *, PurpleKeyringReadCallback, gpointer); -static void internal_keyring_save(PurpleAccount *, gchar *, GDestroyNotify, PurpleKeyringSaveCallback, gpointer); +static void internal_keyring_save(PurpleAccount *, const gchar *, PurpleKeyringSaveCallback, gpointer); static void internal_keyring_close(GError **); static void internal_keyring_open(void); static gboolean internal_keyring_import_password(PurpleAccount *, const char *, const char *, GError **); @@ -120,8 +120,7 @@ static void internal_keyring_save(PurpleAccount * account, - gchar * password, - GDestroyNotify destroy, + const gchar * password, PurpleKeyringSaveCallback cb, gpointer data) { @@ -145,9 +144,6 @@ } - if(destroy && password) - destroy(password); - if (cb != NULL) cb(account, NULL, data); return;
--- a/libpurple/plugins/keyrings/kwallet.cpp Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/plugins/keyrings/kwallet.cpp Mon Oct 31 06:32:01 2011 +0000 @@ -331,15 +331,12 @@ void kwallet_save(PurpleAccount * account, - char * password, - GDestroyNotify destroypassword, + const char * password, PurpleKeyringSaveCallback cb, gpointer data) { KWalletPlugin::read_request req(account, password, cb, data); KWalletPlugin::engine::instance()->queue(req); - if (destroypassword) - destroypassword(password); }
--- a/libpurple/plugins/one_time_password.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/plugins/one_time_password.c Mon Oct 31 06:32:01 2011 +0000 @@ -46,7 +46,7 @@ purple_account_get_username(account), purple_account_get_protocol_name(account)); - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); /* TODO: Do we need to somehow clear conn->password ? */ } }
--- a/libpurple/protocols/gg/gg.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/gg/gg.c Mon Oct 31 06:32:01 2011 +0000 @@ -386,7 +386,7 @@ 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, NULL, NULL, NULL); + purple_account_set_password(account, p1, NULL, NULL); purple_notify_info(NULL, _("New Gadu-Gadu Account Registered"), _("Registration completed successfully!"), NULL); @@ -651,7 +651,7 @@ if (req->http_req->data != NULL && ((struct gg_pubdir*)req->http_req->data)->success == 1) { - purple_account_set_password(req->account, req->new_password, NULL, NULL, NULL); + purple_account_set_password(req->account, req->new_password, NULL, NULL); purple_notify_info(req->account, messagesTitle, _("Password was changed successfully!"), NULL); goto exit_cleanup;
--- a/libpurple/protocols/jabber/auth.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/jabber/auth.c Mon Oct 31 06:32:01 2011 +0000 @@ -110,7 +110,7 @@ if (remember) purple_account_set_remember_password(account, TRUE); - purple_account_set_password(account, entry, NULL, NULL, NULL); + purple_account_set_password(account, entry, NULL, NULL); /* Restart our connection */ jabber_auth_start_old(js); @@ -228,7 +228,7 @@ reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; /* Clear the pasword if it isn't being saved */ if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); } purple_connection_error(js->gc, reason, msg);
--- a/libpurple/protocols/jabber/auth_cyrus.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/jabber/auth_cyrus.c Mon Oct 31 06:32:01 2011 +0000 @@ -154,7 +154,7 @@ if (remember) purple_account_set_remember_password(account, TRUE); - purple_account_set_password(account, entry, NULL, NULL, NULL); + purple_account_set_password(account, entry, NULL, NULL); /* Rebuild our callbacks as we now have a password to offer */ jabber_sasl_build_callbacks(js);
--- a/libpurple/protocols/jabber/jabber.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/jabber/jabber.c Mon Oct 31 06:32:01 2011 +0000 @@ -1264,7 +1264,7 @@ cbdata->js->user->node = g_strdup(value); } if(cbdata->js->registration && !strcmp(id, "password")) - purple_account_set_password(purple_connection_get_account(cbdata->js->gc), value, NULL, NULL, NULL); + purple_account_set_password(purple_connection_get_account(cbdata->js->gc), value, NULL, NULL); } } } @@ -2488,7 +2488,7 @@ purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), _("Your password has been changed.")); - purple_account_set_password(purple_connection_get_account(js->gc), (char *)data, NULL, NULL, NULL); + purple_account_set_password(purple_connection_get_account(js->gc), (const char *)data, NULL, NULL); } else { char *msg = jabber_parse_error(js, packet, NULL); @@ -2744,7 +2744,7 @@ SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); /* Clear the pasword if it isn't being saved */ if (!purple_account_get_remember_password(purple_connection_get_account(js->gc))) - purple_account_set_password(purple_connection_get_account(js->gc), NULL, NULL, NULL, NULL); + purple_account_set_password(purple_connection_get_account(js->gc), NULL, NULL, NULL); text = _("Not Authorized"); } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { text = _("Temporary Authentication Failure");
--- a/libpurple/protocols/msn/session.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/msn/session.c Mon Oct 31 06:32:01 2011 +0000 @@ -384,7 +384,7 @@ reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; msg = g_strdup(_("You have signed on from another location")); if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL, NULL, NULL, NULL); + purple_account_set_password(session->account, NULL, NULL, NULL); break; case MSN_ERROR_SERV_UNAVAILABLE: reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; @@ -404,7 +404,7 @@ _("Unknown error") : info); /* Clear the password if it isn't being saved */ if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL, NULL, NULL, NULL); + purple_account_set_password(session->account, NULL, NULL, NULL); break; case MSN_ERROR_BAD_BLIST: reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
--- a/libpurple/protocols/mxit/actions.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/mxit/actions.c Mon Oct 31 06:32:01 2011 +0000 @@ -335,7 +335,7 @@ out: if ( !err ) { /* update PIN in account */ - purple_account_set_password( session->acc, pin, NULL, NULL, NULL ); + purple_account_set_password( session->acc, pin, NULL, NULL ); /* update session object */ g_free( session->encpwd );
--- a/libpurple/protocols/mxit/login.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/mxit/login.c Mon Oct 31 06:32:01 2011 +0000 @@ -284,7 +284,7 @@ out: if ( !err ) { - purple_account_set_password( session->acc, session->profile->pin, NULL, NULL, NULL ); + purple_account_set_password( session->acc, session->profile->pin, NULL, NULL ); mxit_login_connect( session ); } else {
--- a/libpurple/protocols/myspace/myspace.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/myspace/myspace.c Mon Oct 31 06:32:01 2011 +0000 @@ -1836,7 +1836,7 @@ case MSIM_ERROR_INCORRECT_PASSWORD: /* Incorrect password */ reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL, NULL, NULL, NULL); + purple_account_set_password(session->account, NULL, NULL, NULL); #ifdef MSIM_MAX_PASSWORD_LENGTH if (purple_connection_get_password(session->gc) && (strlen(purple_connection_get_password(session->gc)) > MSIM_MAX_PASSWORD_LENGTH)) { gchar *suggestion; @@ -1861,7 +1861,7 @@ case MSIM_ERROR_LOGGED_IN_ELSEWHERE: /* Logged in elsewhere */ reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL, NULL, NULL, NULL); + purple_account_set_password(session->account, NULL, NULL, NULL); break; } purple_connection_error(session->gc, reason, full_errmsg);
--- a/libpurple/protocols/novell/novell.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/novell/novell.c Mon Oct 31 06:32:01 2011 +0000 @@ -132,7 +132,7 @@ * password was invalid. */ if (!purple_account_get_remember_password(purple_connection_get_account(gc))) - purple_account_set_password(purple_connection_get_account(gc), NULL, NULL, NULL, NULL); + purple_account_set_password(purple_connection_get_account(gc), NULL, NULL, NULL); reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; break; default: @@ -2036,7 +2036,7 @@ if (gc) { if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _("You have signed on from another location"));
--- a/libpurple/protocols/oscar/clientlogin.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/oscar/clientlogin.c Mon Oct 31 06:32:01 2011 +0000 @@ -481,7 +481,7 @@ if (status_code == 330 && status_detail_code == 3011) { PurpleAccount *account = purple_connection_get_account(gc); if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password"));
--- a/libpurple/protocols/oscar/flap_connection.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/oscar/flap_connection.c Mon Oct 31 06:32:01 2011 +0000 @@ -468,7 +468,7 @@ reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; tmp = g_strdup(_("You have signed on from another location")); if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); } else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) tmp = g_strdup(_("Server closed the connection")); else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION)
--- a/libpurple/protocols/oscar/oscar.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/oscar/oscar.c Mon Oct 31 06:32:01 2011 +0000 @@ -1095,7 +1095,7 @@ case 0x05: /* Incorrect password */ if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password")); break; case 0x11:
--- a/libpurple/protocols/silc/silc.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/silc/silc.c Mon Oct 31 06:32:01 2011 +0000 @@ -481,7 +481,7 @@ if (remember) purple_account_set_remember_password(account, TRUE); - purple_account_set_password(account, password, NULL, NULL, NULL); + purple_account_set_password(account, password, NULL, NULL); /* Load SILC key pair */ g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir());
--- a/libpurple/protocols/simple/simple.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/simple/simple.c Mon Oct 31 06:32:01 2011 +0000 @@ -1122,7 +1122,7 @@ purple_debug_info("simple", "REGISTER retries %d\n", sip->registrar.retries); if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { if (!purple_account_get_remember_password(purple_connection_get_account(sip->gc))) - purple_account_set_password(purple_connection_get_account(sip->gc), NULL, NULL, NULL, NULL); + purple_account_set_password(purple_connection_get_account(sip->gc), NULL, NULL, NULL); purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password"));
--- a/libpurple/protocols/yahoo/libymsg.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/protocols/yahoo/libymsg.c Mon Oct 31 06:32:01 2011 +0000 @@ -158,7 +158,7 @@ if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _("You have signed on from another location")); return; @@ -1959,7 +1959,7 @@ /* Password incorrect */ /* Set password to NULL. Avoids account locking. Brings dialog to enter password if clicked on Re-enable account */ if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); error_reason = g_strdup(_("Incorrect password")); error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; break; @@ -2256,7 +2256,7 @@ } #endif /* TRY_WEBMESSENGER_LOGIN */ if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); msg = g_strdup(_("Invalid username or password")); reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
--- a/libpurple/prpl.c Mon Oct 31 03:11:52 2011 +0000 +++ b/libpurple/prpl.c Mon Oct 31 06:32:01 2011 +0000 @@ -361,7 +361,7 @@ if (!purple_account_get_remember_password(account)) { PurpleConnection *gc = purple_account_get_connection(account); if (gc && purple_connection_had_error(gc)) - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); } if (!purple_account_is_disconnected(account))
--- a/pidgin/gtkaccount.c Mon Oct 31 03:11:52 2011 +0000 +++ b/pidgin/gtkaccount.c Mon Oct 31 06:32:01 2011 +0000 @@ -1374,7 +1374,7 @@ /* Remember Password */ remember = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check)); if(!remember) - purple_keyring_set_password(account, NULL, NULL, NULL, NULL); + purple_keyring_set_password(account, NULL, NULL, NULL); purple_account_set_remember_password(account, remember); @@ -1395,9 +1395,9 @@ * don't want to prompt them. */ if ((purple_account_get_remember_password(account) || new_acct) && (*value != '\0')) { - purple_account_set_password(account, value, NULL, NULL, NULL); + purple_account_set_password(account, value, NULL, NULL); } else { - purple_account_set_password(account, NULL, NULL, NULL, NULL); + purple_account_set_password(account, NULL, NULL, NULL); } purple_account_set_username(account, username);