summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorSimeon Simeonov2018-03-09 14:02:34 +0100
committerSimeon Simeonov2018-03-09 14:02:34 +0100
commitf1babd48f5259186cd1233288992f942d4b5b0bb (patch)
tree54d740ef2201fceb3e54fac31272e80e65079ec7 /src/main.c
parent57944f6147f077ccf4d84b9d2659f4e8645e8858 (diff)
Complete rewrite of the master password implementation
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index be8ea54..7c1cd7b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -87,6 +87,7 @@
87#include "foldersel.h" 87#include "foldersel.h"
88#include "update_check.h" 88#include "update_check.h"
89#include "colorlabel.h" 89#include "colorlabel.h"
90#include "masterpassword.h"
90 91
91#if USE_GPGME 92#if USE_GPGME
92# include "rfc2015.h" 93# include "rfc2015.h"
@@ -275,6 +276,32 @@ int main(int argc, char *argv[])
275 CHDIR_EXIT_IF_FAIL(get_home_dir(), 1); 276 CHDIR_EXIT_IF_FAIL(get_home_dir(), 1);
276 277
277 prefs_common_read_config(); 278 prefs_common_read_config();
279 set_master_password(NULL);
280#if USE_SSL
281 if (prefs_common.use_master_password) {
282 if (prefs_common.master_password_hash != NULL) {
283 if (check_master_password_interactively(3)) {
284 if (alertpanel(_("Master password"),
285 _("Unable to set master password"),
286 GTK_STOCK_DISCARD,
287 GTK_STOCK_QUIT,
288 NULL) != G_ALERTDEFAULT) {
289 exit(1);
290 }
291 }
292 } else {
293 if (set_master_password_interactively(3) != 0) {
294 if (alertpanel(_("Master password"),
295 _("Unable to set master password"),
296 GTK_STOCK_DISCARD,
297 GTK_STOCK_QUIT,
298 NULL) != G_ALERTDEFAULT) {
299 exit(1);
300 }
301 }
302 }
303 }
304#endif
278 filter_set_addressbook_func(addressbook_has_address); 305 filter_set_addressbook_func(addressbook_has_address);
279 filter_read_config(); 306 filter_read_config();
280 prefs_actions_read_config(); 307 prefs_actions_read_config();
@@ -995,6 +1022,7 @@ void app_will_exit(gboolean force)
995 1022
996 /* remove temporary files, close log file, socket cleanup */ 1023 /* remove temporary files, close log file, socket cleanup */
997#if USE_SSL 1024#if USE_SSL
1025 unload_master_password();
998 ssl_done(); 1026 ssl_done();
999#endif 1027#endif
1000 syl_cleanup(); 1028 syl_cleanup();