mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
MacOSX: Add PIM value validity checks to workaround wxWidget bug that makes wxTextValidator useless when applied to a text control with password attribute (http://trac.wxwidgets.org/ticket/17185).
This commit is contained in:
20
src/Main/Forms/ChangePasswordDialog.cpp
Normal file → Executable file
20
src/Main/Forms/ChangePasswordDialog.cpp
Normal file → Executable file
@@ -92,6 +92,12 @@ namespace VeraCrypt
|
|||||||
Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
|
Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int currentPim = CurrentPasswordPanel->GetVolumePim();
|
||||||
|
if (-1 == currentPim)
|
||||||
|
{
|
||||||
|
CurrentPasswordPanel->SetFocusToPimTextCtrl();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
shared_ptr <VolumePassword> newPassword;
|
shared_ptr <VolumePassword> newPassword;
|
||||||
int newPim = 0;
|
int newPim = 0;
|
||||||
@@ -108,6 +114,11 @@ namespace VeraCrypt
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newPim = NewPasswordPanel->GetVolumePim();
|
newPim = NewPasswordPanel->GetVolumePim();
|
||||||
|
if (-1 == newPim)
|
||||||
|
{
|
||||||
|
NewPasswordPanel->SetFocusToPimTextCtrl();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (newPassword->Size() > 0)
|
if (newPassword->Size() > 0)
|
||||||
{
|
{
|
||||||
@@ -224,6 +235,9 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
if (passwordEmpty && keyfilesEmpty)
|
if (passwordEmpty && keyfilesEmpty)
|
||||||
ok = false;
|
ok = false;
|
||||||
|
|
||||||
|
if (CurrentPasswordPanel->GetVolumePim () == -1)
|
||||||
|
ok = false;
|
||||||
|
|
||||||
if (DialogMode == Mode::RemoveAllKeyfiles && (passwordEmpty || keyfilesEmpty))
|
if (DialogMode == Mode::RemoveAllKeyfiles && (passwordEmpty || keyfilesEmpty))
|
||||||
ok = false;
|
ok = false;
|
||||||
@@ -237,7 +251,11 @@ namespace VeraCrypt
|
|||||||
ok = false;
|
ok = false;
|
||||||
|
|
||||||
if (DialogMode == Mode::ChangePasswordAndKeyfiles
|
if (DialogMode == Mode::ChangePasswordAndKeyfiles
|
||||||
&& ((NewPasswordPanel->GetPassword()->IsEmpty() && newKeyfilesEmpty) || !NewPasswordPanel->PasswordsMatch()))
|
&& ( (NewPasswordPanel->GetPassword()->IsEmpty() && newKeyfilesEmpty)
|
||||||
|
|| !NewPasswordPanel->PasswordsMatch()
|
||||||
|
|| (NewPasswordPanel->GetVolumePim() == -1)
|
||||||
|
)
|
||||||
|
)
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
23
src/Main/Forms/MountOptionsDialog.cpp
Normal file → Executable file
23
src/Main/Forms/MountOptionsDialog.cpp
Normal file → Executable file
@@ -87,6 +87,25 @@ namespace VeraCrypt
|
|||||||
void MountOptionsDialog::OnOKButtonClick (wxCommandEvent& event)
|
void MountOptionsDialog::OnOKButtonClick (wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
bool bUnsupportedKdf = false;
|
bool bUnsupportedKdf = false;
|
||||||
|
|
||||||
|
/* verify that PIM values are valid before continuing*/
|
||||||
|
int Pim = PasswordPanel->GetVolumePim();
|
||||||
|
int ProtectionPim = (!ReadOnlyCheckBox->IsChecked() && ProtectionCheckBox->IsChecked())?
|
||||||
|
ProtectionPasswordPanel->GetVolumePim() : 0;
|
||||||
|
|
||||||
|
/* invalid PIM: set focus to PIM field and stop processing */
|
||||||
|
if (-1 == Pim)
|
||||||
|
{
|
||||||
|
PasswordPanel->SetFocusToPimTextCtrl();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-1 == ProtectionPim)
|
||||||
|
{
|
||||||
|
ProtectionPasswordPanel->SetFocusToPimTextCtrl();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TransferDataFromWindow();
|
TransferDataFromWindow();
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -98,7 +117,7 @@ namespace VeraCrypt
|
|||||||
Gui->ShowWarning (e);
|
Gui->ShowWarning (e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Options.Pim = PasswordPanel->GetVolumePim();
|
Options.Pim = Pim;
|
||||||
Options.Kdf = PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf);
|
Options.Kdf = PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf);
|
||||||
if (bUnsupportedKdf)
|
if (bUnsupportedKdf)
|
||||||
{
|
{
|
||||||
@@ -124,7 +143,7 @@ namespace VeraCrypt
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Options.Protection = VolumeProtection::HiddenVolumeReadOnly;
|
Options.Protection = VolumeProtection::HiddenVolumeReadOnly;
|
||||||
Options.ProtectionPim = ProtectionPasswordPanel->GetVolumePim();
|
Options.ProtectionPim = ProtectionPim;
|
||||||
Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(Options.TrueCryptMode, bUnsupportedKdf);
|
Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(Options.TrueCryptMode, bUnsupportedKdf);
|
||||||
if (bUnsupportedKdf)
|
if (bUnsupportedKdf)
|
||||||
{
|
{
|
||||||
|
|||||||
6
src/Main/Forms/VolumeCreationWizard.cpp
Normal file → Executable file
6
src/Main/Forms/VolumeCreationWizard.cpp
Normal file → Executable file
@@ -792,6 +792,12 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
if (forward && Password && !Password->IsEmpty())
|
if (forward && Password && !Password->IsEmpty())
|
||||||
{
|
{
|
||||||
|
if (-1 == Pim)
|
||||||
|
{
|
||||||
|
// PIM invalid: don't go anywhere
|
||||||
|
return GetCurrentStep();
|
||||||
|
}
|
||||||
|
|
||||||
if (Password->Size() < VolumePassword::WarningSizeThreshold)
|
if (Password->Size() < VolumePassword::WarningSizeThreshold)
|
||||||
{
|
{
|
||||||
if (Pim > 0 && Pim < 485)
|
if (Pim > 0 && Pim < 485)
|
||||||
|
|||||||
3
src/Main/Forms/VolumePasswordPanel.cpp
Normal file → Executable file
3
src/Main/Forms/VolumePasswordPanel.cpp
Normal file → Executable file
@@ -278,7 +278,8 @@ namespace VeraCrypt
|
|||||||
long pim = 0;
|
long pim = 0;
|
||||||
if (pimStr.IsEmpty())
|
if (pimStr.IsEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
if (pimStr.ToLong (&pim))
|
if (((size_t) wxNOT_FOUND == pimStr.find_first_not_of (wxT("0123456789")))
|
||||||
|
&& pimStr.ToLong (&pim))
|
||||||
return (int) pim;
|
return (int) pim;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
3
src/Main/Forms/VolumePimWizardPage.cpp
Normal file → Executable file
3
src/Main/Forms/VolumePimWizardPage.cpp
Normal file → Executable file
@@ -38,7 +38,8 @@ namespace VeraCrypt
|
|||||||
long pim = 0;
|
long pim = 0;
|
||||||
if (pimStr.IsEmpty())
|
if (pimStr.IsEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
if (pimStr.ToLong (&pim))
|
if (((size_t) wxNOT_FOUND == pimStr.find_first_not_of (wxT("0123456789")))
|
||||||
|
&& pimStr.ToLong (&pim))
|
||||||
return (int) pim;
|
return (int) pim;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user