1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Linux: don't ask for PIM if TrueCryptMode enabled, both in command line and GUI

This commit is contained in:
Mounir IDRASSI
2015-06-26 22:01:04 +02:00
parent d73df9bbd4
commit da8aec4292
6 changed files with 36 additions and 13 deletions

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

@@ -3281,6 +3281,7 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i
KeyfilesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this );
KeyfilesButton->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightDown ), NULL, this );
KeyfilesButton->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightClick ), NULL, this );
TrueCryptModeCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnTrueCryptModeChecked ), NULL, this );
}
VolumePasswordPanelBase::~VolumePasswordPanelBase()
@@ -3294,6 +3295,7 @@ VolumePasswordPanelBase::~VolumePasswordPanelBase()
KeyfilesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this );
KeyfilesButton->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightDown ), NULL, this );
KeyfilesButton->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightClick ), NULL, this );
TrueCryptModeCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnTrueCryptModeChecked ), NULL, this );
}

1
src/Main/Forms/Forms.h Normal file → Executable file
View File

@@ -983,6 +983,7 @@ namespace VeraCrypt
virtual void OnKeyfilesButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnKeyfilesButtonRightDown( wxMouseEvent& event ) { event.Skip(); }
virtual void OnKeyfilesButtonRightClick( wxMouseEvent& event ) { event.Skip(); }
virtual void OnTrueCryptModeChecked( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@@ -26720,7 +26720,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnCheckBox">OnTrueCryptModeChecked</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>

19
src/Main/Forms/VolumePasswordPanel.cpp Normal file → Executable file
View File

@@ -73,6 +73,12 @@ namespace VeraCrypt
if (options && !disableTruecryptMode)
{
TrueCryptModeCheckBox->SetValue (options->TrueCryptMode);
if (options->TrueCryptMode)
{
VolumePimStaticText->Enable (false);
VolumePimTextCtrl->Enable (false);
VolumePinHelpStaticText->Enable (false);
}
}
if (enablePkcs5Prf)
@@ -217,6 +223,8 @@ namespace VeraCrypt
}
int VolumePasswordPanel::GetVolumePim () const
{
if (VolumePimTextCtrl->IsEnabled ())
{
wxString pinStr (VolumePimTextCtrl->GetValue());
long pin = 0;
@@ -227,6 +235,9 @@ namespace VeraCrypt
else
return -1;
}
else
return 0;
}
bool VolumePasswordPanel::GetTrueCryptMode () const
{
@@ -384,4 +395,12 @@ namespace VeraCrypt
}
}
}
void VolumePasswordPanel::OnTrueCryptModeChecked( wxCommandEvent& event )
{
bool bEnablePIM = !GetTrueCryptMode ();
VolumePimStaticText->Enable (bEnablePIM);
VolumePimTextCtrl->Enable (bEnablePIM);
VolumePinHelpStaticText->Enable (bEnablePIM);
}
}

1
src/Main/Forms/VolumePasswordPanel.h Normal file → Executable file
View File

@@ -50,6 +50,7 @@ namespace VeraCrypt
void OnUpdate () { UpdateEvent.Raise(); }
void OnUseKeyfilesCheckBoxClick (wxCommandEvent& event) { OnUpdate(); }
void WipeTextCtrl (wxTextCtrl *textCtrl);
void OnTrueCryptModeChecked( wxCommandEvent& event );
shared_ptr <KeyfileList> Keyfiles;
shared_ptr <Functor> UpdateCallback;

8
src/Main/TextUserInterface.cpp Normal file → Executable file
View File

@@ -444,7 +444,7 @@ namespace VeraCrypt
}
// current PIM
if (!Preferences.NonInteractive && (pim < 0))
if (!truecryptMode && !Preferences.NonInteractive && (pim < 0))
{
pim = AskPim (_("Enter current PIM"));
}
@@ -1120,7 +1120,7 @@ namespace VeraCrypt
if (!options.Password)
options.Password = AskPassword();
if (options.Pim < 0)
if (!options.TrueCryptMode && (options.Pim < 0))
options.Pim = AskPim (_("Enter PIM"));
if (!options.Keyfiles)
@@ -1198,7 +1198,7 @@ namespace VeraCrypt
}
}
if (options.Pim < 0)
if (!options.TrueCryptMode && (options.Pim < 0))
{
options.Pim = AskPim (StringFormatter (_("Enter PIM for {0}"), wstring (*options.Path)));
}
@@ -1217,7 +1217,7 @@ namespace VeraCrypt
{
if (!options.ProtectionPassword)
options.ProtectionPassword = AskPassword (_("Enter password for hidden volume"));
if (options.ProtectionPim < 0)
if (!options.TrueCryptMode && (options.ProtectionPim < 0))
options.ProtectionPim = AskPim (_("Enter PIM for hidden volume"));
if (!options.ProtectionKeyfiles)
options.ProtectionKeyfiles = AskKeyfiles (_("Enter keyfile for hidden volume"));