From a3c5626ea100e08d637d69a680003a5e4a03791b Mon Sep 17 00:00:00 2001 From: Andrej Kacian Date: Sat, 19 Mar 2016 20:50:04 +0100 Subject: [PATCH] Write passwordstore into file more often, not just at exit. --- src/plugins/gdata/cm_gdata_contacts.c | 1 + src/plugins/gdata/gdata_plugin.c | 1 + src/plugins/spam_report/spam_report_prefs.c | 6 ++++++ src/prefs_account.c | 2 ++ 4 files changed, 10 insertions(+) diff --git a/src/plugins/gdata/cm_gdata_contacts.c b/src/plugins/gdata/cm_gdata_contacts.c index fb7526396..46c3385b7 100644 --- a/src/plugins/gdata/cm_gdata_contacts.c +++ b/src/plugins/gdata/cm_gdata_contacts.c @@ -644,6 +644,7 @@ void cm_gdata_contacts_done(void) memset(pass, 0, strlen(pass)); g_free(pass); } + passwd_store_write_config(); #endif g_object_unref(G_OBJECT(authorizer)); diff --git a/src/plugins/gdata/gdata_plugin.c b/src/plugins/gdata/gdata_plugin.c index 99303a19c..3e3e70c2e 100644 --- a/src/plugins/gdata/gdata_plugin.c +++ b/src/plugins/gdata/gdata_plugin.c @@ -127,6 +127,7 @@ gint plugin_init(gchar **error) if(cm_gdata_config.oauth2_refresh_token != NULL) { passwd_store_set(PWS_PLUGIN, "GData", GDATA_TOKEN_PWD_STRING, cm_gdata_config.oauth2_refresh_token, FALSE); + passwd_store_write_config(); } cm_gdata_prefs_init(); diff --git a/src/plugins/spam_report/spam_report_prefs.c b/src/plugins/spam_report/spam_report_prefs.c index 617794a9c..b8b17b995 100644 --- a/src/plugins/spam_report/spam_report_prefs.c +++ b/src/plugins/spam_report/spam_report_prefs.c @@ -77,6 +77,7 @@ void spamreport_prefs_init(void) static gchar *path[3]; gchar *rcpath; guint i; + gboolean passwords_migrated = FALSE; path[0] = _("Plugins"); path[1] = _("SpamReport"); @@ -93,8 +94,11 @@ void spamreport_prefs_init(void) strlen(spamreport_prefs.pass[i]) > 0) { spamreport_passwd_set(spam_interfaces[i].name, spamreport_prefs.pass[i]); + passwords_migrated = TRUE; } } + if (passwords_migrated) + passwd_store_write_config(); spamreport_prefs_page.page.path = path; spamreport_prefs_page.page.create_widget = create_spamreport_prefs_page; @@ -243,4 +247,6 @@ static void save_spamreport_prefs(PrefsPage *page) prefs_file_close_revert(pref_file); } else prefs_file_close(pref_file); + + passwd_store_write_config(); } diff --git a/src/prefs_account.c b/src/prefs_account.c index 1d9b41221..f31db873f 100644 --- a/src/prefs_account.c +++ b/src/prefs_account.c @@ -3693,6 +3693,8 @@ void prefs_account_write_config_all(GList *account_list) if (prefs_file_close(pfile) < 0) g_warning("failed to write configuration to file"); + + passwd_store_write_config(); } #undef WRITE_PARAM -- 2.25.1