VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/TextUserInterface.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-11-30 11:35:41 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-11-30 13:58:19 +0100
commitefa436974d8203485eec6faa1bf0116bb32f6fcd (patch)
tree97a5ef2eea0310a12db399151de7ca97dbd47ece /src/Main/TextUserInterface.cpp
parentcfadb231d24bd292a6ea3708b776bde8f06e50ab (diff)
downloadVeraCrypt-efa436974d8203485eec6faa1bf0116bb32f6fcd.tar.gz
VeraCrypt-efa436974d8203485eec6faa1bf0116bb32f6fcd.zip
Linux/MacOSX: Implement Unicode passwords suppport. Make validation of parameters in GUI more robust.
Diffstat (limited to 'src/Main/TextUserInterface.cpp')
-rw-r--r--src/Main/TextUserInterface.cpp54
1 files changed, 6 insertions, 48 deletions
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index 309a5931..ee2f0b06 100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -97,7 +97,7 @@ namespace VeraCrypt
wchar_t passwordBuf[4096];
finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <byte *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
- make_shared_auto (VolumePassword, password);
+ shared_ptr<VolumePassword> password;
bool verPhase = false;
while (true)
@@ -113,8 +113,7 @@ namespace VeraCrypt
if (!verPhase && length < 1)
{
- password->Set (passwordBuf, 0);
- return password;
+ return shared_ptr <VolumePassword>(new VolumePassword ());
}
for (size_t i = 0; i < length && i < VolumePassword::MaxSize; ++i)
@@ -125,8 +124,7 @@ namespace VeraCrypt
if (verify && verPhase)
{
- make_shared_auto (VolumePassword, verPassword);
- verPassword->Set (passwordBuf, length);
+ shared_ptr <VolumePassword> verPassword = ToUTF8Password (passwordBuf, length);
if (*password != *verPassword)
{
@@ -137,26 +135,10 @@ namespace VeraCrypt
}
}
- password->Set (passwordBuf, length);
+ password = ToUTF8Password (passwordBuf, length);
if (!verPhase)
{
- try
- {
- password->CheckPortability();
- }
- catch (UnportablePassword &e)
- {
- if (verify)
- {
- ShowError (e);
- verPhase = false;
- continue;
- }
-
- ShowWarning ("UNSUPPORTED_CHARS_IN_PWD_RECOM");
- }
-
if (verify)
{
if (password->Size() < VolumePassword::WarningSizeThreshold)
@@ -433,14 +415,7 @@ namespace VeraCrypt
// Current password
if (!passwordInteractive)
{
- try
- {
- password->CheckPortability();
- }
- catch (UnportablePassword &)
- {
- ShowWarning ("UNSUPPORTED_CHARS_IN_PWD_RECOM");
- }
+
}
else if (!Preferences.NonInteractive)
{
@@ -487,9 +462,7 @@ namespace VeraCrypt
}
// New password
- if (newPassword.get())
- newPassword->CheckPortability();
- else if (!Preferences.NonInteractive)
+ if (!newPassword.get() && !Preferences.NonInteractive)
newPassword = AskPassword (_("Enter new password"), true);
// New PIM
@@ -789,9 +762,6 @@ namespace VeraCrypt
ShowString (L"\n");
options->Password = AskPassword (_("Enter password"), true);
}
-
- if (options->Password)
- options->Password->CheckPortability();
// PIM
if ((options->Pim < 0) && !Preferences.NonInteractive)
@@ -1189,18 +1159,6 @@ namespace VeraCrypt
{
options.Password = AskPassword (StringFormatter (_("Enter password for {0}"), wstring (*options.Path)));
}
- else
- {
- try
- {
- if (options.Password)
- options.Password->CheckPortability();
- }
- catch (UnportablePassword &)
- {
- ShowWarning ("UNSUPPORTED_CHARS_IN_PWD_RECOM");
- }
- }
if (!options.TrueCryptMode && (options.Pim < 0))
{