mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-10-06 00:56:35 -05:00
Unix: preserve requested protection when mounting favorites
Keep caller protection unless a favorite requires read-only access. Reuse cached outer credentials when recovering hidden-protection errors.
This commit is contained in:
2 files changed
+9
-5
No files matched your search
@@ -92,7 +92,9 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
options.Path.reset (new VolumePath (Path));
|
options.Path.reset (new VolumePath (Path));
|
||||||
options.PartitionInSystemEncryptionScope = System;
|
options.PartitionInSystemEncryptionScope = System;
|
||||||
options.Protection = (ReadOnly ? VolumeProtection::ReadOnly : VolumeProtection::None);
|
// A favorite may require read-only access, but must not weaken requested protection.
|
||||||
|
if (ReadOnly)
|
||||||
|
options.Protection = VolumeProtection::ReadOnly;
|
||||||
options.SlotNumber = SlotNumber;
|
options.SlotNumber = SlotNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -847,13 +847,15 @@ namespace VeraCrypt
|
|||||||
newMountedVolumes.push_back (Core->MountVolume (favoriteOptions));
|
newMountedVolumes.push_back (Core->MountVolume (favoriteOptions));
|
||||||
mountPerformed = true;
|
mountPerformed = true;
|
||||||
}
|
}
|
||||||
catch (PasswordException&)
|
catch (PasswordException &e)
|
||||||
{
|
{
|
||||||
CloseSecurityTokenSessionsAfterMountScope closeTokenSessionsScope (Preferences.CloseSecurityTokenSessionsAfterMount);
|
CloseSecurityTokenSessionsAfterMountScope closeTokenSessionsScope (Preferences.CloseSecurityTokenSessionsAfterMount);
|
||||||
|
|
||||||
// The initial silent mount attempt has already consulted cached passwords.
|
// A protection failure accepted the outer password. Let the UI recover
|
||||||
// Avoid repeating the same failed cache sweep before prompting the user.
|
// using that cache; only skip a cache sweep that failed outer authentication.
|
||||||
shared_ptr <VolumeInfo> volume = MountVolume (favoriteOptions, false);
|
bool protectionError = dynamic_cast <ProtectionPasswordIncorrect *> (&e)
|
||||||
|
|| dynamic_cast <ProtectionPasswordKeyfilesIncorrect *> (&e);
|
||||||
|
shared_ptr <VolumeInfo> volume = MountVolume (favoriteOptions, protectionError);
|
||||||
|
|
||||||
if (!volume)
|
if (!volume)
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in new issue
Block a user