Linux/OSX: make CLI switch --import-token-keyfiles compatible with Non-Interactive

mode by using keyfiles passed as arguments and check the Non-Interactive
mode switch.
This commit is contained in:
Mounir IDRASSI 2019-09-24 22:04:23 +02:00
parent 89a8b0c262
commit c8beacbdd7
No known key found for this signature in database
GPG Key ID: 02C30AE90FAE4A6F

View File

@ -1056,9 +1056,18 @@ namespace VeraCrypt
slotId = (CK_SLOT_ID) AskSelection (tokens.back().SlotId, tokens.front().SlotId);
}
shared_ptr <KeyfileList> keyfiles = AskKeyfiles();
if (keyfiles->empty())
throw UserAbort();
shared_ptr <KeyfileList> keyfiles;
if (CmdLine->ArgKeyfiles.get() && !CmdLine->ArgKeyfiles->empty())
keyfiles = CmdLine->ArgKeyfiles;
else if (!Preferences.NonInteractive)
{
keyfiles = AskKeyfiles();
if (keyfiles->empty())
throw UserAbort();
}
else
throw MissingArgument (SRC_POS);
foreach_ref (const Keyfile &keyfilePath, *keyfiles)
{