From 8de2d887916cbdd3c2d756e77116585babd026f2 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Wed, 28 Feb 2018 23:51:46 +0100 Subject: prefs_common.use_master_password added --- libsylph/imap.c | 23 +++++++++++------------ libsylph/prefs_common.c | 6 +++++- libsylph/prefs_common.h | 3 +++ 3 files changed, 19 insertions(+), 13 deletions(-) (limited to 'libsylph') diff --git a/libsylph/imap.c b/libsylph/imap.c index a61dc2b..0cd4409 100644 --- a/libsylph/imap.c +++ b/libsylph/imap.c @@ -707,17 +707,17 @@ static gint imap_session_connect(IMAPSession *session) log_message(_("creating IMAP4 connection to %s:%d ...\n"), SESSION(session)->server, SESSION(session)->port); - if (account->master_password != NULL) { - if (decrypt_data(&pass, - account->passwd, - account->master_password, - strlen(account->passwd)) != RC_OK) { - session_destroy(session); - return -1; - } - } else { - pass = account->passwd; - } + if (prefs_common.use_master_password && account->master_password != NULL) { + if (decrypt_data(&pass, + account->passwd, + account->master_password, + strlen(account->passwd) + 1) != RC_OK) { + session_destroy(session); + return -1; + } + } else { + pass = account->passwd; + } if (!pass) pass = account->tmp_pass; if (!pass) { @@ -731,7 +731,6 @@ static gint imap_session_connect(IMAPSession *session) account->tmp_pass = tmp_pass; pass = account->tmp_pass; } - if (account->use_socks && account->use_socks_for_recv && account->proxy_host) { socks_info = socks_info_new(account->socks_type, account->proxy_host, account->proxy_port, account->use_proxy_auth ? account->proxy_name : NULL, account->use_proxy_auth ? account->proxy_pass : NULL); diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c index 91814fd..68f72fa 100644 --- a/libsylph/prefs_common.c +++ b/libsylph/prefs_common.c @@ -415,9 +415,13 @@ static PrefParam param[] = { #ifdef G_OS_WIN32 {"show_gpg_warning", "FALSE", &prefs_common.gpg_warning, P_BOOL}, #else - {"show_gpg_warning", "TRUE", &prefs_common.gpg_warning, P_BOOL}, + {"show_gpg_warning", "TRUE", &prefs_common.gpg_warning, P_BOOL}, #endif + /* Master password */ + {"use_master_password", "FALSE", &prefs_common.use_master_password, + P_BOOL}, + /* Interface */ {"separate_folder", "FALSE", &prefs_common.sep_folder, P_BOOL}, {"separate_message", "FALSE", &prefs_common.sep_msg, P_BOOL}, diff --git a/libsylph/prefs_common.h b/libsylph/prefs_common.h index 910f370..ef5bb9b 100644 --- a/libsylph/prefs_common.h +++ b/libsylph/prefs_common.h @@ -249,6 +249,9 @@ struct _PrefsCommon gboolean passphrase_grab; gboolean gpg_warning; + /* Master password */ + gboolean use_master_password; + /* Interface */ gboolean sep_folder; gboolean sep_msg; -- cgit v1.3