From b8a2e808c693a59e236b98c3274019e5a25b3089 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 25 Jan 2016 01:35:17 +0100 Subject: 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). --- src/Main/Forms/MountOptionsDialog.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/Main/Forms/MountOptionsDialog.cpp (limited to 'src/Main/Forms/MountOptionsDialog.cpp') diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp old mode 100644 new mode 100755 index 14198e68..207d2479 --- a/src/Main/Forms/MountOptionsDialog.cpp +++ b/src/Main/Forms/MountOptionsDialog.cpp @@ -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) { -- cgit v1.2.3