diff options
| author | Simeon Simeonov | 2018-03-09 14:02:34 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2018-03-09 14:02:34 +0100 |
| commit | f1babd48f5259186cd1233288992f942d4b5b0bb (patch) | |
| tree | 54d740ef2201fceb3e54fac31272e80e65079ec7 /libsylph/imap.c | |
| parent | 57944f6147f077ccf4d84b9d2659f4e8645e8858 (diff) | |
Complete rewrite of the master password implementation
Diffstat (limited to 'libsylph/imap.c')
| -rw-r--r-- | libsylph/imap.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/libsylph/imap.c b/libsylph/imap.c index 0cd4409..9ee4b15 100644 --- a/libsylph/imap.c +++ b/libsylph/imap.c | |||
| @@ -52,6 +52,7 @@ | |||
| 52 | #include "utils.h" | 52 | #include "utils.h" |
| 53 | #include "prefs_common.h" | 53 | #include "prefs_common.h" |
| 54 | #include "virtual.h" | 54 | #include "virtual.h" |
| 55 | #include "masterpassword.h" | ||
| 55 | 56 | ||
| 56 | #define IMAP4_PORT 143 | 57 | #define IMAP4_PORT 143 |
| 57 | #if USE_SSL | 58 | #if USE_SSL |
| @@ -705,19 +706,9 @@ static gint imap_session_connect(IMAPSession *session) | |||
| 705 | account = (PrefsAccount *)(SESSION(session)->data); | 706 | account = (PrefsAccount *)(SESSION(session)->data); |
| 706 | 707 | ||
| 707 | log_message(_("creating IMAP4 connection to %s:%d ...\n"), | 708 | log_message(_("creating IMAP4 connection to %s:%d ...\n"), |
| 708 | SESSION(session)->server, SESSION(session)->port); | 709 | SESSION(session)->server, SESSION(session)->port); |
| 709 | 710 | ||
| 710 | if (prefs_common.use_master_password && account->master_password != NULL) { | 711 | pass = decrypt_with_master_password(account->passwd); |
| 711 | if (decrypt_data(&pass, | ||
| 712 | account->passwd, | ||
| 713 | account->master_password, | ||
| 714 | strlen(account->passwd) + 1) != RC_OK) { | ||
| 715 | session_destroy(session); | ||
| 716 | return -1; | ||
| 717 | } | ||
| 718 | } else { | ||
| 719 | pass = account->passwd; | ||
| 720 | } | ||
| 721 | if (!pass) | 712 | if (!pass) |
| 722 | pass = account->tmp_pass; | 713 | pass = account->tmp_pass; |
| 723 | if (!pass) { | 714 | if (!pass) { |
| @@ -731,6 +722,7 @@ static gint imap_session_connect(IMAPSession *session) | |||
| 731 | account->tmp_pass = tmp_pass; | 722 | account->tmp_pass = tmp_pass; |
| 732 | pass = account->tmp_pass; | 723 | pass = account->tmp_pass; |
| 733 | } | 724 | } |
| 725 | |||
| 734 | if (account->use_socks && account->use_socks_for_recv && | 726 | if (account->use_socks && account->use_socks_for_recv && |
| 735 | account->proxy_host) { | 727 | account->proxy_host) { |
| 736 | 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); | 728 | 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); |
