summaryrefslogtreecommitdiff
path: root/libsylph/imap.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsylph/imap.c')
-rw-r--r--libsylph/imap.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/libsylph/imap.c b/libsylph/imap.c
index e773ad4..e1c7cfd 100644
--- a/libsylph/imap.c
+++ b/libsylph/imap.c
@@ -707,8 +707,12 @@ static gint imap_session_connect(IMAPSession *session)
707 707
708 log_message(_("creating IMAP4 connection to %s:%d ...\n"), 708 log_message(_("creating IMAP4 connection to %s:%d ...\n"),
709 SESSION(session)->server, SESSION(session)->port); 709 SESSION(session)->server, SESSION(session)->port);
710 /* TODO: check of the format is correct | possible memory leak */ 710 if (master_password_active()) {
711 pass = decrypt_with_master_password(account->passwd); 711 pass = decrypt_with_master_password(account->passwd);
712 /* a new string is allocated. To be removed ... */
713 } else {
714 pass = account->passwd;
715 }
712 if (!pass) 716 if (!pass)
713 pass = account->tmp_pass; 717 pass = account->tmp_pass;
714 if (!pass) { 718 if (!pass) {
@@ -771,8 +775,11 @@ static gint imap_session_connect(IMAPSession *session)
771#endif 775#endif
772 776
773 if (!session->authenticated && 777 if (!session->authenticated &&
774 imap_auth(session, account->userid, pass, account->imap_auth_type) 778 imap_auth(session, account->userid, pass, account->imap_auth_type)
775 != IMAP_SUCCESS) { 779 != IMAP_SUCCESS) {
780 if (master_password_active()) {
781 g_free(pass); /* remove the decrypted password */
782 }
776 if (account->tmp_pass) { 783 if (account->tmp_pass) {
777 g_free(account->tmp_pass); 784 g_free(account->tmp_pass);
778 account->tmp_pass = NULL; 785 account->tmp_pass = NULL;
@@ -781,6 +788,10 @@ static gint imap_session_connect(IMAPSession *session)
781 return IMAP_AUTHFAIL; 788 return IMAP_AUTHFAIL;
782 } 789 }
783 790
791 if (master_password_active()) {
792 g_free(pass); /* remove the decrypted password */
793 }
794
784 return IMAP_SUCCESS; 795 return IMAP_SUCCESS;
785} 796}
786 797