VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/CommandLineInterface.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-08-31 01:56:56 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-08-31 01:56:56 +0200
commit4470d11c39bca7c3d29f7dd596a8fa66f19d42bc (patch)
treed1899b3a02e915693a1d32e3c88bd007014e77a3 /src/Main/CommandLineInterface.cpp
parent90f91945582b2020f236d666e16028159143c57f (diff)
parent9582d8fbcb57c0297aad3d4a05eac53f1c125cd3 (diff)
downloadVeraCrypt-4470d11c39bca7c3d29f7dd596a8fa66f19d42bc.tar.gz
VeraCrypt-4470d11c39bca7c3d29f7dd596a8fa66f19d42bc.zip
Merge pull request #18 from LouisTakePILLz/master
Linux/MacOSX: Support supplying password to VeraCrypt via pipe (stdin)
Diffstat (limited to 'src/Main/CommandLineInterface.cpp')
-rw-r--r--src/Main/CommandLineInterface.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
index 4b1584c8..3563f0b0 100644
--- a/src/Main/CommandLineInterface.cpp
+++ b/src/Main/CommandLineInterface.cpp
@@ -71,6 +71,7 @@ namespace VeraCrypt
parser.AddOption (L"", L"new-password", _("New password"));
parser.AddOption (L"", L"new-pim", _("New PIM"));
parser.AddSwitch (L"", L"non-interactive", _("Do not interact with user"));
+ parser.AddSwitch (L"", L"stdin", _("Read password from standard input"));
parser.AddOption (L"p", L"password", _("Password"));
parser.AddOption (L"", L"pim", _("PIM"));
parser.AddOption (L"", L"protect-hidden", _("Protect hidden volume"));
@@ -402,9 +403,21 @@ namespace VeraCrypt
Preferences.NonInteractive = true;
}
+ if (parser.Found (L"stdin"))
+ {
+ if (!Preferences.NonInteractive)
+ throw_err (L"--stdin is supported only in non-interactive mode");
+
+ Preferences.UseStandardInput = true;
+ }
+
if (parser.Found (L"password", &str))
+ {
+ if (Preferences.UseStandardInput)
+ throw_err (L"--password cannot be used with --stdin");
ArgPassword.reset (new VolumePassword (wstring (str)));
-
+ }
+
if (parser.Found (L"pim", &str))
{
try