From 1b59879411700450c5d14225ba9c6a509cfe0f8f Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 8 Aug 2018 19:31:25 +0200 Subject: Linux/MacOSX/FreeBSD: When performing backup of volume header, automatically try to use embedded backup header if using the main header fails. --- src/Main/TextUserInterface.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src/Main/TextUserInterface.cpp') diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index 8cd010b3..61b8b8a6 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -317,7 +317,40 @@ namespace VeraCrypt } catch (PasswordException &e) { - ShowInfo (e); + bool bFailed = true; + if (!options->UseBackupHeaders) + { + try + { + volume = Core->OpenVolume ( + options->Path, + options->PreserveTimestamps, + options->Password, + options->Pim, + kdf, + false, + options->Keyfiles, + options->Protection, + options->ProtectionPassword, + options->ProtectionPim, + options->ProtectionKdf, + options->ProtectionKeyfiles, + true, + volumeType, + true + ); + + bFailed = false; + } + catch (...) + { + } + } + + if (bFailed) + ShowInfo (e); + else + ShowInfo ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK"); } } -- cgit v1.2.3