GData is still untested.
const gchar *(*version) (void);
const gchar *(*type) (void);
const gchar *(*licence) (void);
+ void (*master_password_change) (const gchar *oldp, const gchar *newp);
struct PluginFeature *(*provides) (void);
GSList *rdeps;
const gchar *(*plugin_type)(void);
const gchar *(*plugin_licence)(void);
struct PluginFeature *(*plugin_provides)(void);
+ void (*plugin_master_password_change) (const gchar *oldp, const gchar *newp) = NULL;
+
gint ok;
START_TIMING((filename?filename:"NULL plugin"));
cm_return_val_if_fail(filename != NULL, NULL);
g_free(plugin);
return NULL;
}
+
+ /* Optional methods */
+ g_module_symbol(plugin->module, "plugin_master_password_change", (gpointer)&plugin_master_password_change);
if (plugin_licence_check(plugin_licence()) != TRUE) {
*error = g_strdup(_("This module is not licensed under a GPL v3 or later compatible license."));
plugin->type = plugin_type;
plugin->licence = plugin_licence;
plugin->provides = plugin_provides;
+ plugin->master_password_change = plugin_master_password_change;
plugin->filename = g_strdup(filename);
plugin->error = NULL;
return plugin->error;
}
+void plugins_master_password_change(const gchar *oldp, const gchar *newp) {
+ Plugin *plugin = NULL;
+ GSList *cur;
+ for (cur = plugin_get_list(); cur; cur = g_slist_next(cur)) {
+ plugin = (Plugin *)cur->data;
+ if (plugin->master_password_change != NULL) {
+ plugin->master_password_change(oldp, newp);
+ }
+ }
+}
+
/* Generally called in plugin_init() function of each plugin. It check the
* minimal and compiled version of claws binary required by the plugin.
* If (@minimum_claws_version == 0 || @compiled_claws_version == 0), don't
void plugin_save_list (void);
void plugin_load_standard_plugins (void);
+void plugins_master_password_change(const gchar *oldp, const gchar *newp);
+
GSList *plugin_get_list (void);
GSList *plugin_get_unloaded_list(void);
const gchar *plugin_get_name (Plugin *plugin);
#endif
#include "common/passcrypt.h"
+#include "common/plugin.h"
#include "common/utils.h"
#include "account.h"
#include "alertpanel.h"
}
}
+ /* Now reencrypt all plugins passwords fields
+ * FIXME: Unloaded plugins won't be able to update their stored passwords
+ */
+ plugins_master_password_change(oldp, newp);
+
master_password_forget();
}
#endif
prefs_gtk_unregister_page((PrefsPage*) &gdata_page);
}
}
+
+void cm_gdata_master_password_change(const gchar *oldp, const gchar *newp) {
+ gchar *pass;
+ int i;
+
+ pass = password_decrypt(cm_gdata_config.oauth2_refresh_token, oldp);
+ if (pass != NULL) {
+ g_free(cm_gdata_config.oauth2_refresh_token);
+ cm_gdata_config.oauth2_refresh_token = password_encrypt(pass, newp);
+ memset(pass, 0, strlen(pass));
+ }
+ g_free(pass);
+}
void cm_gdata_prefs_init(void);
void cm_gdata_prefs_done(void);
+void cm_gdata_master_password_change(const gchar *oldp, const gchar *newp);
#endif /* CM_GDATA_PREFS_H_ */
return VERSION;
}
+void plugin_master_password_change (const gchar *oldp, const gchar *newp)
+{
+ cm_gdata_prefs_master_password_change(oldp, newp);
+}
+
struct PluginFeature *plugin_provides(void)
{
static struct PluginFeature features[] =
plugin_type
plugin_provides
plugin_version
-
+ plugin_master_password_change
return VERSION;
}
+void plugin_master_password_change (const gchar *oldp, const gchar *newp)
+{
+ spamreport_master_password_change(oldp, newp);
+}
+
struct PluginFeature *plugin_provides(void)
{
static struct PluginFeature features[] =
} else
prefs_file_close(pref_file);
}
+
+void spamreport_master_password_change(const gchar *oldp, const gchar *newp) {
+ gchar *pass;
+ int i;
+
+ for (i = 0; i < INTF_LAST; i++) {
+ pass = password_decrypt(spamreport_prefs.pass[i], oldp);
+ if (pass != NULL) {
+ g_free(spamreport_prefs.pass[i]);
+ spamreport_prefs.pass[i] = password_encrypt(pass, newp);
+ memset(pass, 0, strlen(pass));
+ }
+ g_free(pass);
+ }
+}
void spamreport_prefs_init(void);
void spamreport_prefs_done(void);
+void spamreport_master_password_change(const gchar *oldp, const gchar *newp);
#endif
return VERSION;
}
+void plugin_master_password_change (const gchar *oldp, const gchar *newp)
+{
+ vcal_prefs_master_password_change(oldp, newp);
+}
+
struct PluginFeature *plugin_provides(void)
{
static struct PluginFeature features[] =
plugin_type
plugin_provides
plugin_version
+ plugin_master_password_change
vcal_folder_export(NULL);
}
+void vcal_prefs_master_password_change(const gchar *oldp, const gchar *newp) {
+ gchar *pass;
+ pass = password_decrypt(vcalprefs.export_pass, oldp);
+ if (pass != NULL) {
+ g_free(vcalprefs.export_pass);
+ vcalprefs.export_pass = password_encrypt(pass, newp);
+ memset(pass, 0, strlen(pass));
+ }
+ g_free(pass);
+ pass = password_decrypt(vcalprefs.export_freebusy_pass, oldp);
+ if (pass != NULL) {
+ g_free(vcalprefs.export_freebusy_pass);
+ vcalprefs.export_freebusy_pass = password_encrypt(pass, newp);
+ memset(pass, 0, strlen(pass));
+ }
+ g_free(pass);
+}
+
void vcal_prefs_init(void)
{
static gchar *path[3];
void vcal_prefs_init (void);
void vcal_prefs_done (void);
void vcal_prefs_save (void);
+void vcal_prefs_master_password_change(const gchar *oldp, const gchar *newp);
+
#endif