diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/prefs_common_dialog.c | 47 | ||||
| -rw-r--r-- | src/send_message.c | 25 |
2 files changed, 60 insertions, 12 deletions
diff --git a/src/prefs_common_dialog.c b/src/prefs_common_dialog.c index fa4be4e..dada1b1 100644 --- a/src/prefs_common_dialog.c +++ b/src/prefs_common_dialog.c | |||
| @@ -216,6 +216,12 @@ static struct Privacy { | |||
| 216 | } privacy; | 216 | } privacy; |
| 217 | #endif | 217 | #endif |
| 218 | 218 | ||
| 219 | #if USE_SSL | ||
| 220 | static struct MasterPassword { | ||
| 221 | GtkWidget *checkbtn_use_master_password; | ||
| 222 | } master_password; | ||
| 223 | #endif | ||
| 224 | |||
| 219 | static struct Interface { | 225 | static struct Interface { |
| 220 | GtkWidget *checkbtn_always_show_msg; | 226 | GtkWidget *checkbtn_always_show_msg; |
| 221 | GtkWidget *checkbtn_always_mark_read; | 227 | GtkWidget *checkbtn_always_mark_read; |
| @@ -563,6 +569,11 @@ static PrefsUIData ui_data[] = { | |||
| 563 | prefs_set_data_from_toggle, prefs_set_toggle}, | 569 | prefs_set_data_from_toggle, prefs_set_toggle}, |
| 564 | #endif /* USE_GPGME */ | 570 | #endif /* USE_GPGME */ |
| 565 | 571 | ||
| 572 | #if USE_SSL | ||
| 573 | {"use_master_password", &master_password.checkbtn_use_master_password, | ||
| 574 | prefs_set_data_from_toggle, prefs_set_toggle}, | ||
| 575 | #endif | ||
| 576 | |||
| 566 | /* Interface */ | 577 | /* Interface */ |
| 567 | {"always_show_message_when_selected", | 578 | {"always_show_message_when_selected", |
| 568 | &iface.checkbtn_always_show_msg, | 579 | &iface.checkbtn_always_show_msg, |
| @@ -693,6 +704,9 @@ static void prefs_junk_create (void); | |||
| 693 | #if USE_GPGME | 704 | #if USE_GPGME |
| 694 | static void prefs_privacy_create (void); | 705 | static void prefs_privacy_create (void); |
| 695 | #endif | 706 | #endif |
| 707 | #if USE_SSL | ||
| 708 | static void prefs_master_password_create (void); | ||
| 709 | #endif | ||
| 696 | static void prefs_details_create (void); | 710 | static void prefs_details_create (void); |
| 697 | static GtkWidget *prefs_other_create (void); | 711 | static GtkWidget *prefs_other_create (void); |
| 698 | static GtkWidget *prefs_extcmd_create (void); | 712 | static GtkWidget *prefs_extcmd_create (void); |
| @@ -853,6 +867,10 @@ static void prefs_common_create(void) | |||
| 853 | prefs_privacy_create(); | 867 | prefs_privacy_create(); |
| 854 | SET_NOTEBOOK_LABEL(dialog.notebook, _("Privacy"), page++); | 868 | SET_NOTEBOOK_LABEL(dialog.notebook, _("Privacy"), page++); |
| 855 | #endif | 869 | #endif |
| 870 | #if USE_SSL | ||
| 871 | prefs_master_password_create(); | ||
| 872 | SET_NOTEBOOK_LABEL(dialog.notebook, _("Master password"), page++); | ||
| 873 | #endif | ||
| 856 | prefs_details_create(); | 874 | prefs_details_create(); |
| 857 | SET_NOTEBOOK_LABEL(dialog.notebook, _("Details"), page++); | 875 | SET_NOTEBOOK_LABEL(dialog.notebook, _("Details"), page++); |
| 858 | 876 | ||
| @@ -2648,6 +2666,35 @@ static void prefs_privacy_create(void) | |||
| 2648 | } | 2666 | } |
| 2649 | #endif /* USE_GPGME */ | 2667 | #endif /* USE_GPGME */ |
| 2650 | 2668 | ||
| 2669 | #if USE_SSL | ||
| 2670 | static void prefs_master_password_create(void) | ||
| 2671 | { | ||
| 2672 | GtkWidget *vbox1; | ||
| 2673 | GtkWidget *vbox2; | ||
| 2674 | GtkWidget *hbox1; | ||
| 2675 | GtkWidget *checkbtn_use_master_password; | ||
| 2676 | |||
| 2677 | vbox1 = gtk_vbox_new (FALSE, VSPACING); | ||
| 2678 | gtk_widget_show (vbox1); | ||
| 2679 | gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); | ||
| 2680 | gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); | ||
| 2681 | |||
| 2682 | vbox2 = gtk_vbox_new (FALSE, 0); | ||
| 2683 | gtk_widget_show (vbox2); | ||
| 2684 | gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); | ||
| 2685 | |||
| 2686 | PACK_CHECK_BUTTON (vbox2, checkbtn_use_master_password, | ||
| 2687 | _("Use master password")); | ||
| 2688 | |||
| 2689 | hbox1 = gtk_hbox_new (FALSE, 8); | ||
| 2690 | gtk_widget_show (hbox1); | ||
| 2691 | gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); | ||
| 2692 | |||
| 2693 | master_password.checkbtn_use_master_password | ||
| 2694 | = checkbtn_use_master_password; | ||
| 2695 | } | ||
| 2696 | #endif /* USE_SSL */ | ||
| 2697 | |||
| 2651 | static void prefs_details_create(void) | 2698 | static void prefs_details_create(void) |
| 2652 | { | 2699 | { |
| 2653 | GtkWidget *vbox1; | 2700 | GtkWidget *vbox1; |
diff --git a/src/send_message.c b/src/send_message.c index 695246a..7b66423 100644 --- a/src/send_message.c +++ b/src/send_message.c | |||
| @@ -649,18 +649,19 @@ static gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp) | |||
| 649 | if (ac_prefs->smtp_userid) { | 649 | if (ac_prefs->smtp_userid) { |
| 650 | smtp_session->user = g_strdup(ac_prefs->smtp_userid); | 650 | smtp_session->user = g_strdup(ac_prefs->smtp_userid); |
| 651 | if (ac_prefs->smtp_passwd) { | 651 | if (ac_prefs->smtp_passwd) { |
| 652 | if(ac_prefs->master_password != NULL) { | 652 | if(prefs_common.use_master_password && |
| 653 | if (decrypt_data(&(smtp_session->pass), | 653 | ac_prefs->master_password != NULL) { |
| 654 | ac_prefs->smtp_passwd, | 654 | if (decrypt_data(&(smtp_session->pass), |
| 655 | ac_prefs->master_password, | 655 | ac_prefs->smtp_passwd, |
| 656 | strlen(ac_prefs->smtp_passwd)) != RC_OK) { | 656 | ac_prefs->master_password, |
| 657 | session_destroy(session); | 657 | strlen(ac_prefs->smtp_passwd) + 1) != RC_OK) { |
| 658 | return -1; | 658 | session_destroy(session); |
| 659 | } | 659 | return -1; |
| 660 | } else { | 660 | } |
| 661 | smtp_session->pass = | 661 | } else { |
| 662 | g_strdup(ac_prefs->smtp_passwd); | 662 | smtp_session->pass = |
| 663 | } | 663 | g_strdup(ac_prefs->smtp_passwd); |
| 664 | } | ||
| 664 | } else if (ac_prefs->tmp_smtp_pass) { | 665 | } else if (ac_prefs->tmp_smtp_pass) { |
| 665 | smtp_session->pass = | 666 | smtp_session->pass = |
| 666 | g_strdup(ac_prefs->tmp_smtp_pass); | 667 | g_strdup(ac_prefs->tmp_smtp_pass); |
