From c8beacbdd70c29f9c4a38c43c52c557b30d37fe2 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 24 Sep 2019 22:04:23 +0200 Subject: 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. --- src/Main/TextUserInterface.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index 61b8b8a6..b5263c45 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -1056,9 +1056,18 @@ namespace VeraCrypt slotId = (CK_SLOT_ID) AskSelection (tokens.back().SlotId, tokens.front().SlotId); } - shared_ptr keyfiles = AskKeyfiles(); - if (keyfiles->empty()) - throw UserAbort(); + shared_ptr 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) { -- cgit v1.2.3