commit 9876f5c928084f0fb34d70055f2aca8930156349 from: Oliver Lowe date: Sun Aug 17 02:07:36 2025 UTC Start removing custom app passphrase protection commit - 9490382715e2690d547c0e39a55e555e770fa222 commit + 9876f5c928084f0fb34d70055f2aca8930156349 blob - f8bd67bb4429af7e6e4cf0da96cd8a19494370fd blob + 1d5ec71a3f3e3984541903b9bc33830dc2a613bc --- src/Makefile.am +++ src/Makefile.am @@ -96,7 +96,6 @@ claws_mail_SOURCES = \ oauth2.c \ partial_download.c \ password.c \ - password_gtk.c \ passwordstore.c \ pop.c \ prefs_account.c \ @@ -201,7 +200,6 @@ claws_mailinclude_HEADERS = \ oauth2.h \ partial_download.h \ password.h \ - password_gtk.h \ passwordstore.h \ pop.h \ prefs_account.h \ blob - 7db688cb0cee34ae5ba0f83277012923653f3536 blob + c03e52a04f020ca42e13c1f59f8c0b8186c3b86e --- src/addressbook.c +++ src/addressbook.c @@ -48,7 +48,6 @@ #include "codeconv.h" #include "about.h" #include "addr_compl.h" -#include "password.h" #include "mgutils.h" #include "addressitem.h" blob - 30498fda04c2607f3b7b88d907647dabb54d6cc5 blob + d46ab1a9ae7e57e6f38fec28aad04fe5f5a56c03 --- src/gtk/inputdialog.c +++ src/gtk/inputdialog.c @@ -122,10 +122,7 @@ gchar *input_dialog_with_invisible(const gchar *title, is_pass = TRUE; gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); - if (prefs_common.passphrase_dialog_msg_title_switch) - return input_dialog_open(message, title, NULL, default_string, FALSE, NULL); - else - return input_dialog_open(title, message, NULL, default_string, FALSE, NULL); + return input_dialog_open(title, message, NULL, default_string, FALSE, NULL); } gchar *input_dialog_with_invisible_checkbtn(const gchar *title, const gchar *message, @@ -155,14 +152,9 @@ gchar *input_dialog_with_invisible_checkbtn(const gcha is_pass = TRUE; gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); - if (prefs_common.passphrase_dialog_msg_title_switch) - return input_dialog_open(message, title, checkbtn_label, - default_string, (checkbtn_state? *checkbtn_state:FALSE), - checkbtn_state); - else - return input_dialog_open(title, message, checkbtn_label, - default_string, (checkbtn_state? *checkbtn_state:FALSE), - checkbtn_state); + return input_dialog_open(title, message, checkbtn_label, + default_string, (checkbtn_state? *checkbtn_state:FALSE), + checkbtn_state); } gchar *input_dialog_combo(const gchar *title, const gchar *message, blob - 85e90780d4fdacec8a8d03b0510b10943115da00 blob + 79ca3e232da2014e58882b50b1e2d91fab6c5148 --- src/mainwindow.c +++ src/mainwindow.c @@ -370,8 +370,6 @@ static void sync_cb ( GtkAction *action, static void forget_session_passwords_cb (GtkAction *action, gpointer data ); -static void forget_primary_passphrase_cb (GtkAction *action, - gpointer data ); static gboolean mainwindow_focus_in_event (GtkWidget *widget, GdkEventFocus *focus, gpointer data); @@ -679,7 +677,6 @@ static GtkActionEntry mainwin_entries[] = /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */ {"Tools/ForgetSessionPasswords", NULL, N_("_Forget all session passwords"), NULL, NULL, G_CALLBACK(forget_session_passwords_cb) }, - {"Tools/ForgetPrimaryPassphrase", NULL, N_("Forget _primary passphrase"), NULL, NULL, G_CALLBACK(forget_primary_passphrase_cb) }, /* Configuration menu */ {"Configuration/ChangeAccount", NULL, N_("C_hange current account"), NULL, NULL, NULL }, @@ -1313,7 +1310,6 @@ MainWindow *main_window_create() MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "NetworkLog", "Tools/NetworkLog", GTK_UI_MANAGER_MENUITEM) MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator8", "Tools/---", GTK_UI_MANAGER_SEPARATOR) MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ForgetSessionPasswords", "Tools/ForgetSessionPasswords", GTK_UI_MANAGER_MENUITEM) - MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ForgetPrimaryPassphrase", "Tools/ForgetPrimaryPassphrase", GTK_UI_MANAGER_MENUITEM) MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator9", "Tools/---", GTK_UI_MANAGER_SEPARATOR) /* Configuration menu */ @@ -2414,10 +2410,6 @@ SensitiveCondMask main_window_get_current_state(MainWi } } - if (primary_passphrase_is_entered()) { - UPDATE_STATE(M_MASTER_PASSPHRASE); - } - #undef UPDATE_STATE return state; @@ -2541,7 +2533,6 @@ void main_window_set_menu_sensitive(MainWindow *mainwi SET_SENSITIVE("Menu/Tools/Execute", M_DELAY_EXEC); SET_SENSITIVE("Menu/Tools/Expunge", M_DELETED_EXISTS); SET_SENSITIVE("Menu/Tools/ForgetSessionPasswords", M_SESSION_PASSWORDS); - SET_SENSITIVE("Menu/Tools/ForgetPrimaryPassphrase", M_MASTER_PASSPHRASE); SET_SENSITIVE("Menu/Tools/DeleteDuplicates/SelFolder", M_MSG_EXIST, M_ALLOW_DELETE); SET_SENSITIVE("Menu/Configuration", M_UNLOCKED); @@ -4437,15 +4428,6 @@ static void forget_session_passwords_cb(GtkAction *act fgtn), fgtn, accs); } -static void forget_primary_passphrase_cb(GtkAction *action, gpointer data) -{ - MainWindow *mainwin = (MainWindow *)data; - - main_window_lock(mainwin); - primary_passphrase_forget(); - main_window_unlock(mainwin); -} - void mainwindow_learn (MainWindow *mainwin, gboolean is_spam) { summary_mark_as_spam(mainwin->summaryview, is_spam, NULL); blob - cc9f245c9006ceae319818e56295cd7aed99c021 blob + 72b4d919e2b44659661156a64033786478d9a634 --- src/password.c +++ src/password.c @@ -40,8 +40,6 @@ #include "passwordstore.h" #include "prefs_common.h" -static gchar *_primary_passphrase = NULL; - /* Length of stored key derivation, before base64. */ #define KD_LENGTH 64 @@ -97,181 +95,6 @@ static guchar *_make_key_deriv(const gchar *passphrase return NULL; } -const gchar *primary_passphrase() -{ - gchar *input; - gboolean end = FALSE; - - if (!prefs_common_get_prefs()->use_primary_passphrase) { - return PASSCRYPT_KEY; - } - - if (_primary_passphrase != NULL) { - debug_print("Primary passphrase is in memory, offering it.\n"); - return _primary_passphrase; - } - - while (!end) { - input = input_dialog_with_invisible(_("Input primary passphrase"), - _("Input primary passphrase"), NULL); - - if (input == NULL) { - debug_print("Cancel pressed at primary passphrase dialog.\n"); - break; - } - - if (primary_passphrase_is_correct(input)) { - debug_print("Entered primary passphrase seems to be correct, remembering it.\n"); - _primary_passphrase = input; - end = TRUE; - } else { - alertpanel_error(_("Incorrect primary passphrase.")); - } - } - - return _primary_passphrase; -} - -gboolean primary_passphrase_is_set() -{ - if (prefs_common_get_prefs()->primary_passphrase == NULL - || strlen(prefs_common_get_prefs()->primary_passphrase) == 0) - return FALSE; - - return TRUE; -} - -gboolean primary_passphrase_is_correct(const gchar *input) -{ - guchar *kd, *input_kd; - gchar **tokens; - gchar *stored_kd = prefs_common_get_prefs()->primary_passphrase; - gsize kd_len; - guint rounds = 0; - gint ret; - - g_return_val_if_fail(stored_kd != NULL && strlen(stored_kd) > 0, FALSE); - g_return_val_if_fail(input != NULL, FALSE); - - tokens = g_strsplit_set(stored_kd, "{}", 3); - if (tokens[0] == NULL || - strlen(tokens[0]) != 0 || /* nothing before { */ - tokens[1] == NULL || - strncmp(tokens[1], "PBKDF2-HMAC-SHA1,", 17) || /* correct tag */ - strlen(tokens[1]) <= 17 || /* something after , */ - (rounds = atoi(tokens[1] + 17)) <= 0 || /* valid rounds # */ - tokens[2] == NULL || - strlen(tokens[2]) == 0) { /* string continues after } */ - debug_print("Mangled primary_passphrase format in config, can not use it.\n"); - g_strfreev(tokens); - return FALSE; - } - - stored_kd = tokens[2]; - kd = g_base64_decode(stored_kd, &kd_len); /* should be 64 */ - g_strfreev(tokens); - - if (kd_len != KD_LENGTH) { - debug_print("primary_passphrase is %"G_GSIZE_FORMAT" bytes long, should be %d.\n", - kd_len, KD_LENGTH); - g_free(kd); - return FALSE; - } - - input_kd = _make_key_deriv(input, rounds, KD_LENGTH); - ret = memcmp(kd, input_kd, kd_len); - - g_free(input_kd); - g_free(kd); - - if (ret == 0) - return TRUE; - - return FALSE; -} - -gboolean primary_passphrase_is_entered() -{ - return (_primary_passphrase == NULL) ? FALSE : TRUE; -} - -void primary_passphrase_forget() -{ - /* If primary passphrase is currently in memory (entered by user), - * get rid of it. User will have to enter the new one again. */ - if (_primary_passphrase != NULL) { - memset(_primary_passphrase, 0, strlen(_primary_passphrase)); - g_free(_primary_passphrase); - _primary_passphrase = NULL; - } -} - -void primary_passphrase_change(const gchar *oldp, const gchar *newp) -{ - guchar *kd; - gchar *base64_kd; - guint rounds = prefs_common_get_prefs()->primary_passphrase_pbkdf2_rounds; - - g_return_if_fail(rounds > 0); - - if (oldp == NULL) { - /* If oldp is NULL, make sure the user has to enter the - * current primary passphrase before being able to change it. */ - primary_passphrase_forget(); - oldp = primary_passphrase(); - } - g_return_if_fail(oldp != NULL); - - /* Update primary passphrase hash in prefs */ - if (prefs_common_get_prefs()->primary_passphrase != NULL) - g_free(prefs_common_get_prefs()->primary_passphrase); - - if (newp != NULL) { - debug_print("Storing key derivation of new primary passphrase\n"); - kd = _make_key_deriv(newp, rounds, KD_LENGTH); - base64_kd = g_base64_encode(kd, 64); - prefs_common_get_prefs()->primary_passphrase = - g_strdup_printf("{PBKDF2-HMAC-SHA1,%d}%s", rounds, base64_kd); - g_free(kd); - g_free(base64_kd); - } else { - debug_print("Setting primary_passphrase to NULL\n"); - prefs_common_get_prefs()->primary_passphrase = NULL; - } - - /* Now go over all accounts, reencrypting their passwords using - * the new primary passphrase. */ - - if (oldp == NULL) - oldp = PASSCRYPT_KEY; - if (newp == NULL) - newp = PASSCRYPT_KEY; - - debug_print("Reencrypting all account passwords...\n"); - passwd_store_reencrypt_all(oldp, newp); - - primary_passphrase_forget(); -} - -/* Decryption is still needed for supporting migration of old - * configurations to newer encryption mechanisms. */ -gchar *password_decrypt_old(const gchar *password) -{ - if (!password || strlen(password) == 0) { - return NULL; - } - - if (*password != '!' || strlen(password) < 2) { - return NULL; - } - - gsize len; - gchar *decrypted = g_base64_decode(password + 1, &len); - - passcrypt_decrypt(decrypted, len); - return decrypted; -} - #define BUFSIZE 128 /* Since we can't count on having GnuTLS new enough to have @@ -528,7 +351,7 @@ gchar *password_encrypt(const gchar *password, } if (encryption_passphrase == NULL) - encryption_passphrase = primary_passphrase(); + encryption_passphrase = PASSCRYPT_KEY; return password_encrypt_real(password, encryption_passphrase); } @@ -540,16 +363,9 @@ gchar *password_decrypt(const gchar *password, return NULL; } - /* First, check if the password was possibly decrypted using old, - * obsolete method */ - if (*password == '!') { - debug_print("Trying to decrypt password using the old method...\n"); - return password_decrypt_old(password); - } - /* Try available crypto backend */ if (decryption_passphrase == NULL) - decryption_passphrase = primary_passphrase(); + decryption_passphrase = PASSCRYPT_KEY; if (*password == '{') { debug_print("Trying to decrypt password...\n"); blob - 85bc4be4e50fdbec4a40b611d26f4c772f12e2a8 blob + bcf4d06004b030e34b243f50d59417d9b93d0c92 --- src/password.h +++ src/password.h @@ -21,28 +21,6 @@ #include -/* Returns a pointer to primary passphrase, asking the user - * if necessary. Do not free the return value. */ -const gchar *primary_passphrase(); - -/* Returns TRUE if there is a primary passphrase set in preferences. */ -gboolean primary_passphrase_is_set(); -/* Returns TRUE if input contains correct primary passphrase, as set - * in preferences. */ -gboolean primary_passphrase_is_correct(const gchar *input); -/* Returns TRUE if primary passphrase is entered (unlocked). */ -gboolean primary_passphrase_is_entered(); -/* Removes (locks) primary passphrase, if it was entered previously - * in current session. */ -void primary_passphrase_forget(); - -/* Changes primary passphrase. Also triggers reencryption of all stored - * passwords using the new primary passphrase. - * oldp - old primary passphrase; if NULL, it will be retrieved using - * primary_passphrase() - * newp - new primary passphrase */ -void primary_passphrase_change(const gchar *oldp, const gchar *newp); - gchar *password_encrypt_gnutls(const gchar *password, const gchar *encryption_passphrase); gchar *password_decrypt_gnutls(const gchar *password, blob - 814c14ed5f42005e2892ab0dbeb9178e4e4ddfe6 (mode 644) blob + /dev/null --- src/password_gtk.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 2016-2025 the Claws Mail team and Andrej Kacian - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#include "claws-features.h" -#endif - -#include -#include -#include - -#include "common/utils.h" -#include "gtk/manage_window.h" -#include "gtk/gtkutils.h" -#include "account.h" -#include "alertpanel.h" -#include "password.h" -#include "prefs_common.h" - -static void entry_activated(GtkEntry *entry, gpointer user_data) -{ - const gchar *text = gtk_entry_get_text(entry); - - if (strlen(text) > 0) - gtk_widget_grab_focus(GTK_WIDGET(user_data)); -} - -struct _ctx { - gboolean done; - GtkWidget *dialog; - GtkWidget *entry_old; - GtkWidget *entry_new1; - GtkWidget *entry_new2; -}; - -static void ok_button_clicked(GtkButton *button, gpointer user_data) -{ - struct _ctx *ctx = (struct _ctx *)user_data; - const gchar *old = NULL; - const gchar *new1 = gtk_entry_get_text(GTK_ENTRY(ctx->entry_new1)); - const gchar *new2 = gtk_entry_get_text(GTK_ENTRY(ctx->entry_new2)); - - debug_print("OK button activated\n"); - - /* Now we check the new passphrase - same in both entries. */ - if (strcmp(new1, new2)) { - debug_print("passphrases do not match\n"); - alertpanel_warning(_("New passphrases do not match, try again.")); - gtk_entry_set_text(GTK_ENTRY(ctx->entry_new1), ""); - gtk_entry_set_text(GTK_ENTRY(ctx->entry_new2), ""); - gtk_widget_grab_focus(ctx->entry_new1); - return; - } - - /* If there is an existing primary passphrase, check for its correctness - * in entry_old. */ - if (primary_passphrase_is_set() - && ((old = gtk_entry_get_text(GTK_ENTRY(ctx->entry_old))) == NULL - || strlen(old) == 0 || !primary_passphrase_is_correct(old))) { - debug_print("old passphrase incorrect\n"); - alertpanel_warning(_("Incorrect old primary passphrase entered, try again.")); - gtk_entry_set_text(GTK_ENTRY(ctx->entry_old), ""); - gtk_widget_grab_focus(ctx->entry_old); - return; - } - - primary_passphrase_change(old, new1); - - ctx->done = TRUE; - gtk_widget_destroy(ctx->dialog); - ctx->dialog = NULL; -} - -static void cancel_button_clicked(GtkButton *button, gpointer user_data) -{ - struct _ctx *ctx = (struct _ctx *)user_data; - ctx->done = TRUE; - gtk_widget_destroy(ctx->dialog); - ctx->dialog = NULL; -} - -static void dialog_destroy(GtkWidget *widget, gpointer user_data) -{ - struct _ctx *ctx = (struct _ctx *)user_data; - ctx->done = TRUE; - ctx->dialog = NULL; -} - -void primary_passphrase_change_dialog() -{ - static PangoFontDescription *font_desc; - GtkWidget *dialog; - GtkWidget *vbox, *hbox; - GtkWidget *icon, *table, *label, *sep; - GtkWidget *msg_title; - GtkWidget *entry_old, *entry_new1, *entry_new2; - GtkWidget *ok_button, *cancel_button; - struct _ctx *ctx; - - dialog = gtk_dialog_new(); - - gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - gtk_window_set_default_size(GTK_WINDOW(dialog), 375, 100); - gtk_window_set_title(GTK_WINDOW(dialog), ""); - - MANAGE_WINDOW_SIGNALS_CONNECT(dialog); - - vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); - gtk_box_set_spacing(GTK_BOX(vbox), 14); - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); - gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); - gtk_widget_show(hbox); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - - icon = gtk_image_new_from_icon_name("dialog-password-symbolic", - GTK_ICON_SIZE_DIALOG); - gtk_widget_set_halign(icon, GTK_ALIGN_CENTER); - gtk_widget_set_valign(icon, GTK_ALIGN_START); - gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0); - - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); - gtk_widget_show(vbox); - - msg_title = gtk_label_new(_("Changing primary passphrase")); - gtk_label_set_xalign(GTK_LABEL(msg_title), 0.0); - gtk_label_set_justify(GTK_LABEL(msg_title), GTK_JUSTIFY_LEFT); - gtk_label_set_use_markup (GTK_LABEL (msg_title), TRUE); - gtk_box_pack_start(GTK_BOX(vbox), msg_title, FALSE, FALSE, 0); - gtk_label_set_line_wrap(GTK_LABEL(msg_title), TRUE); - if (!font_desc) { - gint size; - - size = pango_font_description_get_size - (gtk_widget_get_style(msg_title)->font_desc); - font_desc = pango_font_description_new(); - pango_font_description_set_weight - (font_desc, PANGO_WEIGHT_BOLD); - pango_font_description_set_size - (font_desc, size * PANGO_SCALE_LARGE); - } - if (font_desc) - gtk_widget_override_font(msg_title, font_desc); - - label = gtk_label_new( - _("If a primary passphrase is currently active, it\n" - "needs to be entered.") - ); - gtk_label_set_xalign(GTK_LABEL(label), 0.0); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - table = gtk_grid_new(); - gtk_grid_set_row_spacing(GTK_GRID(table), 8); - gtk_grid_set_column_spacing(GTK_GRID(table), 8); - - /* Old passphrase */ - label = gtk_label_new(_("Old passphrase")); - gtk_label_set_xalign(GTK_LABEL(label), 0.0); - gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1); - - entry_old = gtk_entry_new(); - gtk_entry_set_visibility(GTK_ENTRY(entry_old), FALSE); - gtk_grid_attach(GTK_GRID(table), entry_old, 1, 0, 1, 1); - gtk_widget_set_hexpand(entry_old, TRUE); - gtk_widget_set_halign(entry_old, GTK_ALIGN_FILL); - - /* Separator */ - sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); - g_object_set (sep, "margin", 8, NULL); - gtk_grid_attach(GTK_GRID(table), sep, 0, 1, 2, 1); - - /* New passphrase */ - label = gtk_label_new(_("New passphrase")); - gtk_label_set_xalign(GTK_LABEL(label), 0.0); - gtk_grid_attach(GTK_GRID(table), label, 0, 2, 1, 1); - - entry_new1 = gtk_entry_new(); - gtk_entry_set_visibility(GTK_ENTRY(entry_new1), FALSE); - gtk_grid_attach(GTK_GRID(table), entry_new1, 1, 2, 1, 1); - gtk_widget_set_hexpand(entry_new1, TRUE); - gtk_widget_set_halign(entry_new1, GTK_ALIGN_FILL); - - /* New passphrase again */ - label = gtk_label_new(_("Confirm passphrase")); - gtk_label_set_xalign(GTK_LABEL(label), 0.0); - gtk_grid_attach(GTK_GRID(table), label, 0, 3, 1, 1); - - entry_new2 = gtk_entry_new(); - gtk_entry_set_visibility(GTK_ENTRY(entry_new2), FALSE); - gtk_grid_attach(GTK_GRID(table), entry_new2, 1, 3, 1, 1); - gtk_widget_set_hexpand(entry_new2, TRUE); - gtk_widget_set_halign(entry_new2, GTK_ALIGN_FILL); - - gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); - - cancel_button = gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Cancel"), - GTK_RESPONSE_NONE); - ok_button = gtk_dialog_add_button(GTK_DIALOG(dialog),_("_OK"), - GTK_RESPONSE_NONE); - gtk_widget_grab_default(ok_button); - - /* If no primary passphrase is set, disable the "old passphrase" entry */ - if (!primary_passphrase_is_set()) - gtk_widget_set_sensitive(entry_old, FALSE); - - g_signal_connect(G_OBJECT(entry_old), "activate", - G_CALLBACK(entry_activated), entry_new1); - g_signal_connect(G_OBJECT(entry_new1), "activate", - G_CALLBACK(entry_activated), entry_new2); - gtk_entry_set_activates_default(GTK_ENTRY(entry_new2), TRUE); - - ctx = g_new(struct _ctx, 1); - ctx->done = FALSE; - ctx->dialog = dialog; - ctx->entry_old = entry_old; - ctx->entry_new1 = entry_new1; - ctx->entry_new2 = entry_new2; - - g_signal_connect(G_OBJECT(ok_button), "clicked", - G_CALLBACK(ok_button_clicked), ctx); - g_signal_connect(G_OBJECT(cancel_button), "clicked", - G_CALLBACK(cancel_button_clicked), ctx); - - g_signal_connect(G_OBJECT(dialog), "destroy", - G_CALLBACK(dialog_destroy), ctx); - - gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); - gtk_window_present(GTK_WINDOW(dialog)); - - gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); - manage_window_set_transient(GTK_WINDOW(dialog)); - - while (!ctx->done) - gtk_main_iteration(); - - if (ctx->dialog != NULL) - gtk_widget_destroy(ctx->dialog); - - GTK_EVENTS_FLUSH(); - - g_free(ctx); -} blob - d096f3502789973e2c6255bc43728f167d2c34db (mode 644) blob + /dev/null --- src/password_gtk.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 2016 Claws Mail team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifndef __PASSWORD_GTK_H -#define __PASSWORD_GTK_H - -void primary_passphrase_change_dialog(); - -#endif /* __PASSWORD_GTK_H */ blob - 14a1c6906dc6867f55f74d8ced3dc956a7d1f963 blob + 83f06df55dfc118e9b761d16664d5737bacaa555 --- src/prefs_common.c +++ src/prefs_common.c @@ -1022,7 +1022,6 @@ static PrefParam param[] = { {"address_search_wildcard", "TRUE", &prefs_common.address_search_wildcard, P_BOOL, NULL, NULL, NULL}, {"enable_avatars", "3", &prefs_common.enable_avatars, P_INT, NULL, NULL, NULL}, - {"use_master_passphrase", FALSE, &prefs_common.use_primary_passphrase, P_BOOL, NULL, NULL, NULL }, {"master_passphrase", "", &prefs_common.primary_passphrase, P_STRING, NULL, NULL, NULL }, {"master_passphrase_salt", "", &prefs_common.primary_passphrase_salt, P_STRING, NULL, NULL, NULL }, {"master_passphrase_pbkdf2_rounds", "50000", &prefs_common.primary_passphrase_pbkdf2_rounds, P_INT, NULL, NULL, NULL}, @@ -1038,9 +1037,6 @@ static PrefParam param[] = { {"qs_press_timeout", "500", &prefs_common.qs_press_timeout, P_INT, NULL, NULL, NULL}, - {"passphrase_dialog_msg_title_switch", "FALSE", &prefs_common.passphrase_dialog_msg_title_switch, - P_BOOL, NULL, NULL, NULL}, - {"mainwin_toolbar_always_enable_actions", "FALSE", &prefs_common.mainwin_toolbar_always_enable_actions, P_BOOL, NULL, NULL, NULL}, blob - 89a0f59847dc279c0aef933e9c44535303c4c45a blob + a0b3145887e02706050fba38419df0a345a96907 --- src/prefs_common.h +++ src/prefs_common.h @@ -567,7 +567,6 @@ struct _PrefsCommon gchar *primary_passphrase_salt; guint primary_passphrase_pbkdf2_rounds; - gboolean passphrase_dialog_msg_title_switch; gboolean mainwin_toolbar_always_enable_actions; /* Proxy */ blob - 6e793ece389408be8855c105e61f7c196629b1e4 blob + 35924188cbcde96cd130c2ba066fce01e81dc9a1 --- src/prefs_other.c +++ src/prefs_other.c @@ -37,8 +37,6 @@ #include "gtk/gtkutils.h" #include "gtk/prefswindow.h" #include "combobox.h" -#include "password.h" -#include "password_gtk.h" #include "manage_window.h" #ifdef HAVE_LIBETPAN @@ -66,11 +64,8 @@ typedef struct _OtherPage GtkWidget *checkbtn_real_time_sync; GtkWidget *entry_attach_save_chmod; GtkWidget *checkbtn_transhdr; - GtkWidget *checkbtn_use_passphrase; } OtherPage; -static void prefs_change_primary_passphrase(GtkButton *button, gpointer data); - struct KeyBind { const gchar *accel_path; const gchar *accel_key; @@ -365,11 +360,6 @@ static void prefs_other_create_widget(PrefsPage *_page GtkWidget *label_attach_save_chmod; GtkWidget *entry_attach_save_chmod; - GtkWidget *vbox_passphrase; - GtkWidget *frame_passphrase; - GtkWidget *checkbtn_use_passphrase; - GtkWidget *button_change_passphrase; - vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, VSPACING); gtk_widget_show (vbox1); gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); @@ -482,28 +472,6 @@ static void prefs_other_create_widget(PrefsPage *_page g_free(buf); } - vbox_passphrase = gtkut_get_options_frame(vbox1, &frame_passphrase, _("Primary passphrase")); - - PACK_CHECK_BUTTON(vbox_passphrase, checkbtn_use_passphrase, - _("Use a primary passphrase")); - - CLAWS_SET_TIP(checkbtn_use_passphrase, - _("If checked, your saved account passwords will be protected " - "by a primary passphrase. If no primary passphrase is set, " - "you will be prompted to set one")); - - button_change_passphrase = gtk_button_new_with_label( - _("Change primary passphrase")); - gtk_widget_show (button_change_passphrase); - hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox_passphrase), hbox1, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox1), button_change_passphrase, - FALSE, FALSE, 0); - SET_TOGGLE_SENSITIVITY (checkbtn_use_passphrase, button_change_passphrase); - g_signal_connect (G_OBJECT (button_change_passphrase), "clicked", - G_CALLBACK (prefs_change_primary_passphrase), NULL); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_addaddrbyclick), prefs_common.add_address_by_click); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_confonexit), @@ -528,11 +496,6 @@ static void prefs_other_create_widget(PrefsPage *_page gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_real_time_sync), prefs_common.real_time_sync); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_passphrase), - prefs_common.use_primary_passphrase); - gtk_widget_set_sensitive(button_change_passphrase, - prefs_common.use_primary_passphrase); - prefs_other->keys_preset_hbox = keys_preset_hbox; prefs_other->keys_preset_combo = keys_preset_combo; prefs_other->checkbtn_addaddrbyclick = checkbtn_addaddrbyclick; @@ -546,7 +509,6 @@ static void prefs_other_create_widget(PrefsPage *_page prefs_other->checkbtn_askonfilter = checkbtn_askonfilter; prefs_other->checkbtn_real_time_sync = checkbtn_real_time_sync; prefs_other->entry_attach_save_chmod = entry_attach_save_chmod; - prefs_other->checkbtn_use_passphrase = checkbtn_use_passphrase; prefs_other->page.widget = vbox1; } @@ -588,40 +550,6 @@ static void prefs_other_save(PrefsPage *_page) prefs_keybind_preset_changed(GTK_COMBO_BOX(page->keys_preset_combo)); - /* If we're disabling use of primary passphrase, we need to reencrypt - * all account passwords with hardcoded key. */ - if (!gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(page->checkbtn_use_passphrase)) - && primary_passphrase_is_set()) { - primary_passphrase_change(NULL, NULL); - - /* In case user did not finish the passphrase change process - * (e.g. did not enter a correct current primary passphrase), - * we need to enable the "use primary passphrase" checkbox again, - * since the old primary passphrase is still valid. */ - if (primary_passphrase_is_set()) { - gtk_toggle_button_set_active( - GTK_TOGGLE_BUTTON(page->checkbtn_use_passphrase), TRUE); - } - } - - if (gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(page->checkbtn_use_passphrase)) - && !primary_passphrase_is_set()) { - primary_passphrase_change_dialog(); - - /* In case user cancelled the passphrase change dialog, we need - * to disable the "use primary passphrase" checkbox. */ - if (!primary_passphrase_is_set()) { - gtk_toggle_button_set_active( - GTK_TOGGLE_BUTTON(page->checkbtn_use_passphrase), FALSE); - } - } - - prefs_common.use_primary_passphrase = - gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(page->checkbtn_use_passphrase)); - gtk_enable_accels = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(page->checkbtn_gtk_enable_accels)); @@ -681,8 +609,3 @@ void prefs_other_done(void) prefs_gtk_unregister_page((PrefsPage *) prefs_other); g_free(prefs_other); } - -void prefs_change_primary_passphrase(GtkButton *button, gpointer data) -{ - primary_passphrase_change_dialog(); -}