VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main')
-rw-r--r--src/Main/GraphicUserInterface.cpp54
-rw-r--r--src/Main/TextUserInterface.cpp6
-rw-r--r--src/Main/TextUserInterface.h4
3 files changed, 32 insertions, 32 deletions
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index ad14748e..9169a548 100644
--- a/src/Main/GraphicUserInterface.cpp
+++ b/src/Main/GraphicUserInterface.cpp
@@ -37,6 +37,32 @@
namespace VeraCrypt
{
+ class AdminPasswordGUIRequestHandler : public GetStringFunctor
+ {
+ public:
+ virtual void operator() (string &passwordStr)
+ {
+
+ wxString sValue;
+ if (Gui->GetWaitDialog())
+ {
+ Gui->GetWaitDialog()->RequestAdminPassword(sValue);
+ if (sValue.IsEmpty())
+ throw UserAbort (SRC_POS);
+ }
+ else
+ {
+ wxPasswordEntryDialog dialog (Gui->GetActiveWindow(), LangString["LINUX_ADMIN_PW_QUERY"], LangString["LINUX_ADMIN_PW_QUERY_TITLE"]);
+ if (dialog.ShowModal() != wxID_OK)
+ throw UserAbort (SRC_POS);
+ sValue = dialog.GetValue();
+ }
+ wstring wPassword (sValue); // A copy of the password is created here by wxWidgets, which cannot be erased
+ finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); });
+
+ StringConverter::ToSingle (wPassword, passwordStr);
+ }
+ };
#ifdef TC_MACOSX
int GraphicUserInterface::g_customIdCmdV = 0;
int GraphicUserInterface::g_customIdCmdA = 0;
@@ -452,33 +478,7 @@ namespace VeraCrypt
shared_ptr <GetStringFunctor> GraphicUserInterface::GetAdminPasswordRequestHandler ()
{
- class AdminPasswordRequestHandler : public GetStringFunctor
- {
- public:
- virtual void operator() (string &passwordStr)
- {
-
- wxString sValue;
- if (Gui->GetWaitDialog())
- {
- Gui->GetWaitDialog()->RequestAdminPassword(sValue);
- if (sValue.IsEmpty())
- throw UserAbort (SRC_POS);
- }
- else
- {
- wxPasswordEntryDialog dialog (Gui->GetActiveWindow(), LangString["LINUX_ADMIN_PW_QUERY"], LangString["LINUX_ADMIN_PW_QUERY_TITLE"]);
- if (dialog.ShowModal() != wxID_OK)
- throw UserAbort (SRC_POS);
- sValue = dialog.GetValue();
- }
- wstring wPassword (sValue); // A copy of the password is created here by wxWidgets, which cannot be erased
- finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); });
-
- StringConverter::ToSingle (wPassword, passwordStr);
- }
- };
- return shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler);
+ return shared_ptr <GetStringFunctor> (new AdminPasswordGUIRequestHandler);
}
int GraphicUserInterface::GetCharHeight (wxWindow *window) const
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index 46559dfa..8494a45c 100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -30,10 +30,10 @@
namespace VeraCrypt
{
- class AdminPasswordRequestHandler : public GetStringFunctor
+ class AdminPasswordTextRequestHandler : public GetStringFunctor
{
public:
- AdminPasswordRequestHandler (TextUserInterface *userInterface) : UI (userInterface) { }
+ AdminPasswordTextRequestHandler (TextUserInterface *userInterface) : UI (userInterface) { }
virtual void operator() (string &passwordStr)
{
UI->ShowString (_("Enter your user password or administrator password: "));
@@ -1116,7 +1116,7 @@ namespace VeraCrypt
shared_ptr <GetStringFunctor> TextUserInterface::GetAdminPasswordRequestHandler ()
{
- return shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler (this));
+ return shared_ptr <GetStringFunctor> (new AdminPasswordTextRequestHandler (this));
}
void TextUserInterface::ImportTokenKeyfiles () const
diff --git a/src/Main/TextUserInterface.h b/src/Main/TextUserInterface.h
index 44494f32..34a7cb40 100644
--- a/src/Main/TextUserInterface.h
+++ b/src/Main/TextUserInterface.h
@@ -19,11 +19,11 @@
namespace VeraCrypt
{
- class AdminPasswordRequestHandler;
+ class AdminPasswordTextRequestHandler;
class TextUserInterface : public UserInterface
{
public:
- friend class AdminPasswordRequestHandler;
+ friend class AdminPasswordTextRequestHandler;
TextUserInterface ();
virtual ~TextUserInterface ();