summaryrefslogtreecommitdiff
path: root/libsylph/prefs_account.c
diff options
context:
space:
mode:
authorSimeon Simeonov2018-03-18 17:07:51 +0100
committerSimeon Simeonov2018-03-18 17:07:51 +0100
commit0a708b4e41e80263f8c8e4a5a399c69cec1608c6 (patch)
tree12017f84acb912e4410c31f2b4c75b8fd11a9898 /libsylph/prefs_account.c
parentc94746703a3e0b59372b3bbf9355112c6a85d2dc (diff)
Use the mpes1: - tag for passwords encrypted with master password
Diffstat (limited to 'libsylph/prefs_account.c')
-rw-r--r--libsylph/prefs_account.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/libsylph/prefs_account.c b/libsylph/prefs_account.c
index 1aecba9..fc4d8f1 100644
--- a/libsylph/prefs_account.c
+++ b/libsylph/prefs_account.c
@@ -34,6 +34,7 @@
34#include "customheader.h" 34#include "customheader.h"
35#include "account.h" 35#include "account.h"
36#include "utils.h" 36#include "utils.h"
37#include "masterpassword.h"
37 38
38static PrefsAccount tmp_ac_prefs; 39static PrefsAccount tmp_ac_prefs;
39 40
@@ -205,7 +206,7 @@ PrefsAccount *prefs_account_new(void)
205void prefs_account_read_config(PrefsAccount *ac_prefs, const gchar *label) 206void prefs_account_read_config(PrefsAccount *ac_prefs, const gchar *label)
206{ 207{
207 const gchar *p = label; 208 const gchar *p = label;
208 gchar *rcpath; 209 gchar *rcpath, *tmp_str;
209 gint id; 210 gint id;
210 211
211 g_return_if_fail(ac_prefs != NULL); 212 g_return_if_fail(ac_prefs != NULL);
@@ -229,6 +230,32 @@ void prefs_account_read_config(PrefsAccount *ac_prefs, const gchar *label)
229 ac_prefs->use_apop_auth = TRUE; 230 ac_prefs->use_apop_auth = TRUE;
230 } 231 }
231 232
233 if (master_password_active()) {
234 if ((ac_prefs->passwd != NULL) &&
235 !mpes_string_prefix(ac_prefs->passwd)) {
236 /* TODO: Perhaps some prompt? */
237 debug_print(
238 "%s -> converting passwd cleartext to encrypted\n",
239 label);
240 tmp_str = ac_prefs->passwd;
241 ac_prefs->passwd = encrypt_with_master_password(ac_prefs->passwd);
242 g_free(tmp_str);
243 }
244
245 if ((ac_prefs->smtp_passwd != NULL) &&
246 !mpes_string_prefix(ac_prefs->smtp_passwd)) {
247 /* TODO: Perhaps some prompt? */
248 debug_print(
249 "%s -> converting smtp_passwd from cleartext to encrypted\n",
250 label);
251 tmp_str = ac_prefs->smtp_passwd;
252 ac_prefs->smtp_passwd = encrypt_with_master_password(
253 ac_prefs->smtp_passwd);
254 g_free(tmp_str);
255 }
256
257 }
258
232 custom_header_read_config(ac_prefs); 259 custom_header_read_config(ac_prefs);
233} 260}
234 261