1
0
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:
Mounir IDRASSI
2016-01-25 01:35:17 +01:00
parent e9d3ba0b11
commit b8a2e808c6
5 changed files with 50 additions and 5 deletions

23
src/Main/Forms/MountOptionsDialog.cpp Normal file → Executable file
View File

@@ -87,6 +87,25 @@ namespace VeraCrypt
void MountOptionsDialog::OnOKButtonClick (wxCommandEvent& event)
{
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();
try
@@ -98,7 +117,7 @@ namespace VeraCrypt
Gui->ShowWarning (e);
return;
}
Options.Pim = PasswordPanel->GetVolumePim();
Options.Pim = Pim;
Options.Kdf = PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf);
if (bUnsupportedKdf)
{
@@ -124,7 +143,7 @@ namespace VeraCrypt
return;
}
Options.Protection = VolumeProtection::HiddenVolumeReadOnly;
Options.ProtectionPim = ProtectionPasswordPanel->GetVolumePim();
Options.ProtectionPim = ProtectionPim;
Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(Options.TrueCryptMode, bUnsupportedKdf);
if (bUnsupportedKdf)
{