From: Colin Leroy Date: Thu, 11 Feb 2016 10:21:52 +0000 (+0100) Subject: vCalendar: Use new password API X-Git-Tag: 3.14.0~170 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=e5bb832c169c89c8cba735e25f639774eccf7324 vCalendar: Use new password API --- diff --git a/src/plugins/vcalendar/claws.def b/src/plugins/vcalendar/claws.def index de9bbe51c..1d38f533d 100644 --- a/src/plugins/vcalendar/claws.def +++ b/src/plugins/vcalendar/claws.def @@ -109,6 +109,7 @@ mimeview_register_viewer_factory mimeview_unregister_viewer_factory move_file open_uri +password_decrypt prefs_button_toggled prefs_common prefs_common_get_uri_cmd diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c index c52a39970..96630cda3 100644 --- a/src/plugins/vcalendar/vcal_folder.c +++ b/src/plugins/vcalendar/vcal_folder.c @@ -60,6 +60,7 @@ #include "mainwindow.h" #include "statusbar.h" #include "msgcache.h" +#include "password.h" #include "timing.h" #include "messageview.h" @@ -1170,13 +1171,19 @@ void vcal_folder_export(Folder *folder) { FolderItem *item = folder?folder->inbox:NULL; gboolean need_scan = folder?vcal_scan_required(folder, item):TRUE; + gchar *export_pass = NULL; + gchar *export_freebusy_pass = NULL; if (vcal_folder_lock_count) /* blocked */ return; vcal_folder_lock_count++; + + export_pass = password_decrypt(vcalprefs.export_pass, NULL); + export_freebusy_pass = password_decrypt(vcalprefs.export_freebusy_pass, NULL); + if (vcal_meeting_export_calendar(vcalprefs.export_path, vcalprefs.export_user, - vcalprefs.export_pass, + export_pass, TRUE)) { debug_print("exporting calendar\n"); if (vcalprefs.export_enable && @@ -1185,9 +1192,13 @@ void vcal_folder_export(Folder *folder) execute_command_line( vcalprefs.export_command, TRUE); } + if (export_pass != NULL) { + memset(export_pass, 0, strlen(export_pass)); + } + g_free(export_pass); if (vcal_meeting_export_freebusy(vcalprefs.export_freebusy_path, vcalprefs.export_freebusy_user, - vcalprefs.export_freebusy_pass)) { + export_freebusy_pass)) { debug_print("exporting freebusy\n"); if (vcalprefs.export_freebusy_enable && vcalprefs.export_freebusy_command && @@ -1195,6 +1206,10 @@ void vcal_folder_export(Folder *folder) execute_command_line( vcalprefs.export_freebusy_command, TRUE); } + if (export_freebusy_pass != NULL) { + memset(export_freebusy_pass, 0, strlen(export_freebusy_pass)); + } + g_free(export_freebusy_pass); vcal_folder_lock_count--; if (!need_scan && folder) { vcal_set_mtime(folder, folder->inbox); diff --git a/src/plugins/vcalendar/vcal_meeting_gtk.c b/src/plugins/vcalendar/vcal_meeting_gtk.c index 2b99c08ef..0c7a36c33 100644 --- a/src/plugins/vcalendar/vcal_meeting_gtk.c +++ b/src/plugins/vcalendar/vcal_meeting_gtk.c @@ -2127,7 +2127,7 @@ putfile: file = tmp; } if (fp) { - res = vcal_curl_put(file, fp, filesize, user, pass); + res = vcal_curl_put(file, fp, filesize, user, (pass != NULL ? pass : "")); fclose(fp); } g_free(file); @@ -2275,7 +2275,7 @@ gboolean vcal_meeting_export_freebusy(const gchar *path, const gchar *user, file = tmp; } if (fp) { - res = vcal_curl_put(file, fp, filesize, user, pass); + res = vcal_curl_put(file, fp, filesize, user, (pass != NULL ? pass : "")); fclose(fp); } g_free(file); diff --git a/src/plugins/vcalendar/vcal_prefs.c b/src/plugins/vcalendar/vcal_prefs.c index 4d420409c..06c6fd447 100644 --- a/src/plugins/vcalendar/vcal_prefs.c +++ b/src/plugins/vcalendar/vcal_prefs.c @@ -30,6 +30,7 @@ #include "defs.h" #include "mainwindow.h" +#include "password.h" #include "prefs.h" #include "prefs_gtk.h" #include "prefswindow.h" @@ -268,6 +269,8 @@ static void vcal_prefs_create_widget_func(PrefsPage * _page, GtkWidget *frame_ssl_options; GtkWidget *ssl_verify_peer_checkbtn; + gchar *export_pass = NULL; + gchar *export_freebusy_pass = NULL; vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); @@ -559,10 +562,23 @@ static void vcal_prefs_create_widget_func(PrefsPage * _page, if (!vcalprefs.export_freebusy_pass) vcalprefs.export_freebusy_pass = g_strdup(""); + export_pass = password_decrypt(vcalprefs.export_pass, NULL); + export_freebusy_pass = password_decrypt(vcalprefs.export_freebusy_pass, NULL); + gtk_entry_set_text(GTK_ENTRY(export_user_entry), vcalprefs.export_user); - gtk_entry_set_text(GTK_ENTRY(export_pass_entry), vcalprefs.export_pass); + gtk_entry_set_text(GTK_ENTRY(export_pass_entry), (export_pass != NULL ? export_pass : "")); gtk_entry_set_text(GTK_ENTRY(export_freebusy_user_entry), vcalprefs.export_freebusy_user); - gtk_entry_set_text(GTK_ENTRY(export_freebusy_pass_entry), vcalprefs.export_freebusy_pass); + gtk_entry_set_text(GTK_ENTRY(export_freebusy_pass_entry), (export_freebusy_pass != NULL ? export_freebusy_pass : "")); + + if (export_pass != NULL) { + memset(export_pass, 0, strlen(export_pass)); + } + g_free(export_pass); + + if (export_freebusy_pass != NULL) { + memset(export_freebusy_pass, 0, strlen(export_freebusy_pass)); + } + g_free(export_freebusy_pass); g_signal_connect(G_OBJECT(export_enable_checkbtn), "toggled", G_CALLBACK(path_changed), page);