mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-09-26 09:54:15 +00:00
Unix: preserve protection and keyfile exception types
Check PasswordIncorrect subclasses before the base class in both UI exception handlers. This prevents slicing and preserves the specific protection and keyfile error messages.
This commit is contained in:
@@ -33,12 +33,13 @@ namespace VeraCrypt
|
|||||||
void WaitDialog::ThrowException(Exception* ex)
|
void WaitDialog::ThrowException(Exception* ex)
|
||||||
{
|
{
|
||||||
#define VC_CONVERT_EXCEPTION(NAME) if (dynamic_cast<NAME*> (ex)) throw (NAME&) *ex;
|
#define VC_CONVERT_EXCEPTION(NAME) if (dynamic_cast<NAME*> (ex)) throw (NAME&) *ex;
|
||||||
VC_CONVERT_EXCEPTION (PasswordIncorrect);
|
// Handle PasswordIncorrect subclasses before the base class to avoid slicing.
|
||||||
VC_CONVERT_EXCEPTION (PasswordKeyfilesIncorrect);
|
VC_CONVERT_EXCEPTION (PasswordKeyfilesIncorrect);
|
||||||
VC_CONVERT_EXCEPTION (PasswordOrKeyboardLayoutIncorrect);
|
VC_CONVERT_EXCEPTION (PasswordOrKeyboardLayoutIncorrect);
|
||||||
VC_CONVERT_EXCEPTION (PasswordOrMountOptionsIncorrect);
|
VC_CONVERT_EXCEPTION (PasswordOrMountOptionsIncorrect);
|
||||||
VC_CONVERT_EXCEPTION (ProtectionPasswordIncorrect);
|
VC_CONVERT_EXCEPTION (ProtectionPasswordIncorrect);
|
||||||
VC_CONVERT_EXCEPTION (ProtectionPasswordKeyfilesIncorrect);
|
VC_CONVERT_EXCEPTION (ProtectionPasswordKeyfilesIncorrect);
|
||||||
|
VC_CONVERT_EXCEPTION (PasswordIncorrect);
|
||||||
VC_CONVERT_EXCEPTION (PasswordEmpty);
|
VC_CONVERT_EXCEPTION (PasswordEmpty);
|
||||||
VC_CONVERT_EXCEPTION (PasswordTooLong);
|
VC_CONVERT_EXCEPTION (PasswordTooLong);
|
||||||
VC_CONVERT_EXCEPTION (PasswordUTF8TooLong);
|
VC_CONVERT_EXCEPTION (PasswordUTF8TooLong);
|
||||||
|
|||||||
@@ -1872,12 +1872,13 @@ const FileManager fileManagers[] = {
|
|||||||
|
|
||||||
void UserInterface::ThrowException (Exception* ex)
|
void UserInterface::ThrowException (Exception* ex)
|
||||||
{
|
{
|
||||||
VC_CONVERT_EXCEPTION (PasswordIncorrect);
|
// Handle PasswordIncorrect subclasses before the base class to avoid slicing.
|
||||||
VC_CONVERT_EXCEPTION (PasswordKeyfilesIncorrect);
|
VC_CONVERT_EXCEPTION (PasswordKeyfilesIncorrect);
|
||||||
VC_CONVERT_EXCEPTION (PasswordOrKeyboardLayoutIncorrect);
|
VC_CONVERT_EXCEPTION (PasswordOrKeyboardLayoutIncorrect);
|
||||||
VC_CONVERT_EXCEPTION (PasswordOrMountOptionsIncorrect);
|
VC_CONVERT_EXCEPTION (PasswordOrMountOptionsIncorrect);
|
||||||
VC_CONVERT_EXCEPTION (ProtectionPasswordIncorrect);
|
VC_CONVERT_EXCEPTION (ProtectionPasswordIncorrect);
|
||||||
VC_CONVERT_EXCEPTION (ProtectionPasswordKeyfilesIncorrect);
|
VC_CONVERT_EXCEPTION (ProtectionPasswordKeyfilesIncorrect);
|
||||||
|
VC_CONVERT_EXCEPTION (PasswordIncorrect);
|
||||||
VC_CONVERT_EXCEPTION (PasswordEmpty);
|
VC_CONVERT_EXCEPTION (PasswordEmpty);
|
||||||
VC_CONVERT_EXCEPTION (PasswordTooLong);
|
VC_CONVERT_EXCEPTION (PasswordTooLong);
|
||||||
VC_CONVERT_EXCEPTION (PasswordUTF8TooLong);
|
VC_CONVERT_EXCEPTION (PasswordUTF8TooLong);
|
||||||
|
|||||||
Reference in New Issue
Block a user