VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-06-07 23:04:54 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-06-08 01:16:29 +0200
commit00cd134720f754f008fdc541afdd9ab70f6d11da (patch)
tree38e240d25e3ca3e554bf50c9eeffa7446a7f3a5a
parentc3c1bdd29d932f2b38e7c3995498f9a4eab8702b (diff)
downloadVeraCrypt-00cd134720f754f008fdc541afdd9ab70f6d11da.tar.gz
VeraCrypt-00cd134720f754f008fdc541afdd9ab70f6d11da.zip
Windows: Add command line switch parameter for temporary caching of password during favorites mounting (/cache favorites). Correct implementation of "/cache y".
-rw-r--r--src/Mount/Mount.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index ba3ee861..b14061bc 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -78,16 +78,17 @@ BootEncryptionStatus RecentBootEncStatus;
BOOL bExplore = FALSE; /* Display explorer window after mount */
BOOL bBeep = FALSE; /* Donot beep after mount */
char szFileName[TC_MAX_PATH+1]; /* Volume to mount */
char szDriveLetter[3]; /* Drive Letter to mount */
char commandLineDrive = 0;
BOOL bCacheInDriver = FALSE; /* Cache any passwords we see */
BOOL bCacheInDriverDefault = FALSE;
BOOL bCacheDuringMultipleMount = FALSE;
+BOOL bCmdCacheDuringMultipleMount = FALSE;
BOOL bHistoryCmdLine = FALSE; /* History control is always disabled */
BOOL bUseDifferentTrayIconIfVolMounted = TRUE;
BOOL bCloseDismountedWindows=TRUE; /* Close all open explorer windows of dismounted volume */
BOOL bWipeCacheOnExit = FALSE; /* Wipe password from chace on exit */
BOOL bWipeCacheOnAutoDismount = TRUE;
BOOL bEnableBkgTask = FALSE;
BOOL bCloseBkgTaskWhenNoVolumes = FALSE;
BOOL bDismountOnLogOff = TRUE;
@@ -4032,16 +4033,17 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int
static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
{
BOOL status = FALSE;
char fileName[MAX_PATH];
int mounted = 0, EffectiveVolumePkcs5 = CmdVolumePkcs5;
BOOL EffectiveVolumeTrueCryptMode = CmdVolumeTrueCryptMode;
int EffectiveVolumePin = (pin < 0)? CmdVolumePin : pin;
+ BOOL bEffectiveCacheDuringMultipleMount = bCmdCacheDuringMultipleMount? TRUE: bCacheDuringMultipleMount;
/* Priority is given to command line parameters
* Default values used only when nothing specified in command line
*/
if (EffectiveVolumePkcs5 == 0)
EffectiveVolumePkcs5 = DefaultVolumePkcs5;
if (!EffectiveVolumeTrueCryptMode)
EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode;
@@ -4110,17 +4112,17 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, 0, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
if (!mounted)
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, 0, EffectiveVolumePin, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
burn (&emptyPassword, sizeof (emptyPassword));
}
// Test password and/or keyfiles used for the previous volume
- if (!mounted && bCacheDuringMultipleMount && MultipleMountOperationInProgress && VolumePassword.Length != 0)
+ if (!mounted && bEffectiveCacheDuringMultipleMount && MultipleMountOperationInProgress && VolumePassword.Length != 0)
{
// try TrueCrypt mode first as it is quick, only if pin = 0
if (EffectiveVolumePin == 0)
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, 0, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
if (!mounted)
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, 0, EffectiveVolumePin, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
}
@@ -7599,26 +7601,31 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
break;
case OptionBeep:
bBeep = TRUE;
break;
case OptionCache:
{
- char szTmp[8] = {0};
+ char szTmp[16] = {0};
bCacheInDriver = TRUE;
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs,
szTmp, sizeof (szTmp)))
{
if (!_stricmp(szTmp,"n") || !_stricmp(szTmp,"no"))
bCacheInDriver = FALSE;
else if (!_stricmp(szTmp,"y") || !_stricmp(szTmp,"yes"))
+ bCacheInDriver = TRUE;
+ else if (!_stricmp(szTmp,"f") || !_stricmp(szTmp,"favorites"))
+ {
bCacheInDriver = FALSE;
+ bCmdCacheDuringMultipleMount = TRUE;
+ }
else
AbortProcess ("COMMAND_LINE_ERROR");
}
}
break;
case CommandDismount: