mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-10-05 16:46:35 -05:00
CLI: preserve read-only mode with protection credentials
Apply the same read-only precedence as protect-hidden=yes when parsing hidden-volume passwords, keyfiles, and PIMs.
This commit is contained in:
1 file changed
+3
@@ -572,12 +572,14 @@ namespace VeraCrypt
|
|||||||
if (parser.Found (L"protection-keyfiles", &str))
|
if (parser.Found (L"protection-keyfiles", &str))
|
||||||
{
|
{
|
||||||
ArgMountOptions.ProtectionKeyfiles = ToKeyfileList (str);
|
ArgMountOptions.ProtectionKeyfiles = ToKeyfileList (str);
|
||||||
|
if (ArgMountOptions.Protection != VolumeProtection::ReadOnly)
|
||||||
ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly;
|
ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.Found (L"protection-password", &str))
|
if (parser.Found (L"protection-password", &str))
|
||||||
{
|
{
|
||||||
ArgMountOptions.ProtectionPassword = ToUTF8Password (str.c_str(), -1, ArgUseLegacyPassword? VolumePassword::MaxLegacySize : VolumePassword::MaxSize);
|
ArgMountOptions.ProtectionPassword = ToUTF8Password (str.c_str(), -1, ArgUseLegacyPassword? VolumePassword::MaxLegacySize : VolumePassword::MaxSize);
|
||||||
|
if (ArgMountOptions.Protection != VolumeProtection::ReadOnly)
|
||||||
ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly;
|
ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,6 +597,7 @@ namespace VeraCrypt
|
|||||||
throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str);
|
throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str);
|
||||||
}
|
}
|
||||||
ArgMountOptions.ProtectionPim = pim;
|
ArgMountOptions.ProtectionPim = pim;
|
||||||
|
if (ArgMountOptions.Protection != VolumeProtection::ReadOnly)
|
||||||
ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly;
|
ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user