mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-08-29 04:07:37 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd101433c5 | ||
|
|
d4a237fbaf | ||
|
|
77e4830c99 | ||
|
|
213dd2e74a | ||
|
|
22aec149de | ||
|
|
efdfc4f273 | ||
|
|
960f5993b2 |
@@ -6,7 +6,7 @@ Information about Corsican localization:
|
||||
https://github.com/veracrypt/VeraCrypt/blob/master/Translations/Language.co.xml
|
||||
|
||||
2. History of Corsican translation for VeraCrypt:
|
||||
- Updated in 2026 by Patriccollu di Santa Maria è Sichè: May 2nd (1.26.28), May 9th (1.26.28)
|
||||
- Updated in 2026 by Patriccollu di Santa Maria è Sichè: May 2nd (1.26.28), May 9th (1.26.28), May 13th (1.26.28)
|
||||
- Updated in 2025 by Patriccollu di Santa Maria è Sichè: May 5th (1.26.21), May 25th (1.26.24), June 26th (1.26.27),
|
||||
Aug. 31st (1.26.27), Sep. 27th (1.26.27)
|
||||
- Updated in 2024 by Patriccollu di Santa Maria è Sichè: Aug. 2nd (1.26.13), Aug. 10th (1.26.13)
|
||||
@@ -1703,11 +1703,11 @@ Information about Corsican localization:
|
||||
<entry lang="co" key="FORMAT_STAGE_PREPARING_TEMP_DEVICE">Cumpiimentu di a creazione di u vulume : appruntata di l’apparechju timpurariu.</entry>
|
||||
<entry lang="co" key="FORMAT_STAGE_CREATING_FILESYSTEM">Cumpiimentu di a creazione di u vulume : creazione di u sistema di schedarii impieghendu {0}.</entry>
|
||||
<entry lang="co" key="FORMAT_STAGE_DISMOUNTING_TEMP_VOLUME">Cumpiimentu di a creazione di u vulume : smuntatura di u vulume timpurariu.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_SYNTHESIZED_DEVICE">The selected device '{0}' is an APFS synthesized container or volume and cannot be used as a raw VeraCrypt volume host.\n\nSelect the physical APFS store partition{1} instead.</entry>
|
||||
<entry lang="en" key="MACOSX_DEVICE_SYSTEM_PARTITION">The selected device '{0}' is a macOS system/support partition and cannot be used as a VeraCrypt volume host.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_SYSTEM_STORE">The selected APFS physical store '{0}' contains the currently mounted macOS system volume and cannot be used as a VeraCrypt volume host.</entry>
|
||||
<entry lang="en" key="MACOSX_DEVICE_NOT_WRITABLE">macOS reports the selected device '{0}' as read-only. Select a writable physical partition or disk.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_EROFS_HINT">macOS reported the selected device as read-only. If this is an APFS disk, make sure you selected the physical APFS store partition, not an APFS synthesized volume. Use Disk Utility or 'diskutil list' to identify the physical partition, then retry.</entry>
|
||||
<entry lang="co" key="MACOSX_APFS_SYNTHESIZED_DEVICE">L’apparechju selezziunatu « {0} » hè un cuntenidore o un vulume APFS sintetizatu è ùn pò micca esse impiegatu cum’è un ospite di vulume VeraCrypt di basa.\n\nSelezziunate piuttostu a partizione{1} d’allucamentu APFS fisica.</entry>
|
||||
<entry lang="co" key="MACOSX_DEVICE_SYSTEM_PARTITION">L’apparechju selezziunatu « {0} » hè una partizione macOS di u sistema o d’assistenza è ùn pò micca esse impiegata cum’è un ospite di vulume VeraCrypt.</entry>
|
||||
<entry lang="co" key="MACOSX_APFS_SYSTEM_STORE">L’allucamentu fisicu APFS selezziunatu « {0} » cuntene u vulume di u sistema macOS muntatu attualmente è ùn pò micca esse impiegatu cum’è un ospite di vulume VeraCrypt.</entry>
|
||||
<entry lang="co" key="MACOSX_DEVICE_NOT_WRITABLE">macOS signaleghja l’apparechju selezziunatu « {0} » cum’è essendu in lettura sola. Selezziunate una partizione fisica o un discu induve si pò scrive.</entry>
|
||||
<entry lang="co" key="MACOSX_APFS_EROFS_HINT">macOS hà signalatu l’apparechju selezziunatu cum’è essendu in lettura sola. S’ellu hè un discu APFS, assicuratevi chì ghjè a partizione d’allucamentu APFS fisica chì hè selezziunata, è micca un vulume APFS sintetizatu. Impiegate l’attrezzu di discu o « diskutil list » per identificà a partizione fisica eppò pruvate torna.</entry>
|
||||
</localization>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="VeraCrypt">
|
||||
|
||||
@@ -1685,11 +1685,11 @@
|
||||
<entry lang="de" key="FORMAT_STAGE_PREPARING_TEMP_DEVICE">Abschluss der Volume-Erstellung: Vorbereiten des temporären Geräts.</entry>
|
||||
<entry lang="de" key="FORMAT_STAGE_CREATING_FILESYSTEM">Abschluss der Volume-Erstellung: Erstellen des Dateisystems mit {0}.</entry>
|
||||
<entry lang="de" key="FORMAT_STAGE_DISMOUNTING_TEMP_VOLUME">Abschluss der Volume-Erstellung: Temporäres Volume wird ausgehängt.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_SYNTHESIZED_DEVICE">The selected device '{0}' is an APFS synthesized container or volume and cannot be used as a raw VeraCrypt volume host.\n\nSelect the physical APFS store partition{1} instead.</entry>
|
||||
<entry lang="en" key="MACOSX_DEVICE_SYSTEM_PARTITION">The selected device '{0}' is a macOS system/support partition and cannot be used as a VeraCrypt volume host.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_SYSTEM_STORE">The selected APFS physical store '{0}' contains the currently mounted macOS system volume and cannot be used as a VeraCrypt volume host.</entry>
|
||||
<entry lang="en" key="MACOSX_DEVICE_NOT_WRITABLE">macOS reports the selected device '{0}' as read-only. Select a writable physical partition or disk.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_EROFS_HINT">macOS reported the selected device as read-only. If this is an APFS disk, make sure you selected the physical APFS store partition, not an APFS synthesized volume. Use Disk Utility or 'diskutil list' to identify the physical partition, then retry.</entry>
|
||||
<entry lang="de" key="MACOSX_APFS_SYNTHESIZED_DEVICE">Das ausgewählte Gerät '{0}' ist ein synthetischer APFS-Container oder ein synthetisches APFS-Volume und kann nicht als Host für ein VeraCrypt-Raw-Volume verwendet werden.\n\nWählen Sie stattdessen die physische APFS-Speicherpartition{1} aus.</entry>
|
||||
<entry lang="de" key="MACOSX_DEVICE_SYSTEM_PARTITION">Das ausgewählte Gerät '{0}' ist eine macOS-System-/Support-Partition und kann nicht als Host für ein VeraCrypt-Volume verwendet werden.</entry>
|
||||
<entry lang="de" key="MACOSX_APFS_SYSTEM_STORE">Die ausgewählte physische APFS-Speicherpartition '{0}' enthält das derzeit eingebundene macOS-Systemvolume und kann nicht als VeraCrypt-Volume-Host verwendet werden.</entry>
|
||||
<entry lang="de" key="MACOSX_DEVICE_NOT_WRITABLE">macOS meldet, dass das ausgewählte Gerät '{0}' schreibgeschützt ist. Wählen Sie eine beschreibbare physische Partition oder Festplatte aus.</entry>
|
||||
<entry lang="de" key="MACOSX_APFS_EROFS_HINT">macOS hat das ausgewählte Gerät als schreibgeschützt gemeldet. Handelt es sich um eine APFS-Festplatte, stellen Sie sicher, dass Sie die physische APFS-Speicherpartition ausgewählt haben und nicht ein synthetisches APFS-Volume. Identifizieren Sie die physische Partition mit dem Festplatten-Dienstprogramm oder dem Befehl „diskutil list“ und versuchen Sie es dann erneut.</entry>
|
||||
</localization>
|
||||
<!-- XML-Schema -->
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||||
<VeraCrypt>
|
||||
<localization prog-version="1.26.28">
|
||||
<language langid="nl" name="Nederlands" en-name="Dutch" version="2026-05-08" translators="Jan van der Wal, Peter Tak, Thomas De Rocker"/>
|
||||
<language langid="nl" name="Nederlands" en-name="Dutch" version="2026-05-13" translators="Jan van der Wal, Peter Tak, Thomas De Rocker"/>
|
||||
<font lang="nl" class="normal" size="11" face="default"/>
|
||||
<font lang="nl" class="bold" size="13" face="Arial"/>
|
||||
<font lang="nl" class="fixed" size="12" face="Lucida Console"/>
|
||||
@@ -1682,11 +1682,11 @@
|
||||
<entry lang="nl" key="FORMAT_STAGE_PREPARING_TEMP_DEVICE">Aanmaken van volume voltooien: tijdelijk apparaat voorbereiden.</entry>
|
||||
<entry lang="nl" key="FORMAT_STAGE_CREATING_FILESYSTEM">Aanmaken van volume voltooien: bestandssysteem aanmaken met {0}.</entry>
|
||||
<entry lang="nl" key="FORMAT_STAGE_DISMOUNTING_TEMP_VOLUME">Aanmaken van volume voltooien: tijdelijk volume ontkoppelen.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_SYNTHESIZED_DEVICE">The selected device '{0}' is an APFS synthesized container or volume and cannot be used as a raw VeraCrypt volume host.\n\nSelect the physical APFS store partition{1} instead.</entry>
|
||||
<entry lang="en" key="MACOSX_DEVICE_SYSTEM_PARTITION">The selected device '{0}' is a macOS system/support partition and cannot be used as a VeraCrypt volume host.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_SYSTEM_STORE">The selected APFS physical store '{0}' contains the currently mounted macOS system volume and cannot be used as a VeraCrypt volume host.</entry>
|
||||
<entry lang="en" key="MACOSX_DEVICE_NOT_WRITABLE">macOS reports the selected device '{0}' as read-only. Select a writable physical partition or disk.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_EROFS_HINT">macOS reported the selected device as read-only. If this is an APFS disk, make sure you selected the physical APFS store partition, not an APFS synthesized volume. Use Disk Utility or 'diskutil list' to identify the physical partition, then retry.</entry>
|
||||
<entry lang="nl" key="MACOSX_APFS_SYNTHESIZED_DEVICE">Het geselecteerde apparaat ‘{0}’ is een door APFS gesynthetiseerde container of een APFS-volume en kan niet worden gebruikt als host voor een onbewerkt VeraCrypt-volume.\n\nSelecteer in plaats daarvan de fysieke APFS-opslagpartitie{1}.</entry>
|
||||
<entry lang="nl" key="MACOSX_DEVICE_SYSTEM_PARTITION">Het geselecteerde apparaat ‘{0}’ is een systeem-/ondersteuningspartitie van macOS en kan niet worden gebruikt als host voor een VeraCrypt-volume.</entry>
|
||||
<entry lang="nl" key="MACOSX_APFS_SYSTEM_STORE">De geselecteerde fysieke APFS-opslag ‘{0}’ bevat het momenteel gekoppelde macOS-systeemvolume en kan niet worden gebruikt als host voor een VeraCrypt-volume.</entry>
|
||||
<entry lang="nl" key="MACOSX_DEVICE_NOT_WRITABLE">macOS meldt dat het geselecteerde apparaat ‘{0}’ alleen-lezen is. Selecteer een fysieke partitie of schijf waarop geschreven kan worden.</entry>
|
||||
<entry lang="nl" key="MACOSX_APFS_EROFS_HINT">macOS geeft aan dat het geselecteerde apparaat alleen-lezen is. Als dit een APFS-schijf is, controleer dan of u de fysieke APFS-opslagpartitie hebt geselecteerd en niet een gesynthetiseerd APFS-volume. Gebruik Schijfhulpprogramma of ‘diskutil list’ om de fysieke partitie te identificeren en probeer het vervolgens opnieuw.</entry>
|
||||
</localization>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
|
||||
<xs:element name="VeraCrypt">
|
||||
|
||||
@@ -1683,11 +1683,11 @@
|
||||
<entry lang="zh-cn" key="FORMAT_STAGE_PREPARING_TEMP_DEVICE">正在完成卷创建:准备临时设备。</entry>
|
||||
<entry lang="zh-cn" key="FORMAT_STAGE_CREATING_FILESYSTEM">正在完成卷创建:使用 {0} 创建文件系统。</entry>
|
||||
<entry lang="zh-cn" key="FORMAT_STAGE_DISMOUNTING_TEMP_VOLUME">正在完成卷创建:卸载临时卷。</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_SYNTHESIZED_DEVICE">The selected device '{0}' is an APFS synthesized container or volume and cannot be used as a raw VeraCrypt volume host.\n\nSelect the physical APFS store partition{1} instead.</entry>
|
||||
<entry lang="en" key="MACOSX_DEVICE_SYSTEM_PARTITION">The selected device '{0}' is a macOS system/support partition and cannot be used as a VeraCrypt volume host.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_SYSTEM_STORE">The selected APFS physical store '{0}' contains the currently mounted macOS system volume and cannot be used as a VeraCrypt volume host.</entry>
|
||||
<entry lang="en" key="MACOSX_DEVICE_NOT_WRITABLE">macOS reports the selected device '{0}' as read-only. Select a writable physical partition or disk.</entry>
|
||||
<entry lang="en" key="MACOSX_APFS_EROFS_HINT">macOS reported the selected device as read-only. If this is an APFS disk, make sure you selected the physical APFS store partition, not an APFS synthesized volume. Use Disk Utility or 'diskutil list' to identify the physical partition, then retry.</entry>
|
||||
<entry lang="zh-cn" key="MACOSX_APFS_SYNTHESIZED_DEVICE">所选设备 '{0}' 是 APFS 合成容器或卷,不能作为原始 VeraCrypt 卷的承载设备使用。\n\n请改选物理 APFS 存储分区{1}。</entry>
|
||||
<entry lang="zh-cn" key="MACOSX_DEVICE_SYSTEM_PARTITION">所选设备 '{0}' 是 macOS 系统/支持分区,无法作为 VeraCrypt 卷主机使用。</entry>
|
||||
<entry lang="zh-cn" key="MACOSX_APFS_SYSTEM_STORE">所选 APFS 物理存储 '{0}' 包含当前挂载的 macOS 系统卷,无法作为 VeraCrypt 卷主机使用。</entry>
|
||||
<entry lang="zh-cn" key="MACOSX_DEVICE_NOT_WRITABLE">macOS 报告所选设备 '{0}' 为只读。请选择可写的物理分区或磁盘。</entry>
|
||||
<entry lang="zh-cn" key="MACOSX_APFS_EROFS_HINT">macOS 报告所选设备为只读。如果这是 APFS 磁盘,请确保您选择的是物理 APFS 存储分区,而不是 APFS 合成卷。请使用“磁盘工具”或 'diskutil list' 来识别物理分区,然后重试。</entry>
|
||||
</localization>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="VeraCrypt">
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Platform/SystemLog.h"
|
||||
#include "Platform/Thread.h"
|
||||
#include "Platform/Unix/Poller.h"
|
||||
#include "Platform/Unix/Process.h"
|
||||
#include "Core/Core.h"
|
||||
#include "CoreUnix.h"
|
||||
#include "CoreServiceRequest.h"
|
||||
@@ -27,6 +28,66 @@
|
||||
|
||||
namespace VeraCrypt
|
||||
{
|
||||
#ifdef TC_MACOSX
|
||||
static bool IsMacOSXDevicePathWithPrefix (const string &path, const string &prefix)
|
||||
{
|
||||
if (path.find (prefix) != 0 || path.size() <= prefix.size())
|
||||
return false;
|
||||
|
||||
size_t index = prefix.size();
|
||||
while (index < path.size() && path[index] >= '0' && path[index] <= '9')
|
||||
++index;
|
||||
|
||||
if (index == prefix.size())
|
||||
return false;
|
||||
|
||||
if (index == path.size())
|
||||
return true;
|
||||
|
||||
if (path[index++] != 's')
|
||||
return false;
|
||||
|
||||
size_t sliceStart = index;
|
||||
while (index < path.size() && path[index] >= '0' && path[index] <= '9')
|
||||
++index;
|
||||
|
||||
return index > sliceStart && index == path.size();
|
||||
}
|
||||
|
||||
static bool IsMacOSXFormatterDevicePath (const string &path)
|
||||
{
|
||||
return IsMacOSXDevicePathWithPrefix (path, "/dev/disk")
|
||||
|| IsMacOSXDevicePathWithPrefix (path, "/dev/rdisk");
|
||||
}
|
||||
|
||||
static list <string> BuildMacOSXAPFSFormatterArguments (const ExecuteMacOSXAPFSFormatterRequest &request)
|
||||
{
|
||||
if (!IsMacOSXFormatterDevicePath (request.Device))
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
|
||||
if (request.OwnerUserId > static_cast <uint64> ((uid_t) -1)
|
||||
|| request.OwnerGroupId > static_cast <uint64> ((gid_t) -1))
|
||||
{
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
}
|
||||
|
||||
stringstream uid;
|
||||
stringstream gid;
|
||||
list <string> arguments;
|
||||
|
||||
uid << request.OwnerUserId;
|
||||
gid << request.OwnerGroupId;
|
||||
|
||||
arguments.push_back ("-U");
|
||||
arguments.push_back (uid.str());
|
||||
arguments.push_back ("-G");
|
||||
arguments.push_back (gid.str());
|
||||
arguments.push_back (string (request.Device));
|
||||
|
||||
return arguments;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
unique_ptr <T> CoreService::GetResponse ()
|
||||
{
|
||||
@@ -201,6 +262,17 @@ namespace VeraCrypt
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
// ExecuteMacOSXAPFSFormatterRequest
|
||||
ExecuteMacOSXAPFSFormatterRequest *executeAPFSFormatterRequest = dynamic_cast <ExecuteMacOSXAPFSFormatterRequest*> (request.get());
|
||||
if (executeAPFSFormatterRequest)
|
||||
{
|
||||
Process::Execute (CoreService::GetMacOSXAPFSFormatterPath(), BuildMacOSXAPFSFormatterArguments (*executeAPFSFormatterRequest));
|
||||
ExecuteMacOSXAPFSFormatterResponse().Serialize (outputStream);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
// MountVolumeRequest
|
||||
MountVolumeRequest *mountRequest = dynamic_cast <MountVolumeRequest*> (request.get());
|
||||
if (mountRequest)
|
||||
@@ -290,6 +362,19 @@ namespace VeraCrypt
|
||||
return SendRequest <GetHostDevicesResponse> (request)->HostDevices;
|
||||
}
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
const char *CoreService::GetMacOSXAPFSFormatterPath ()
|
||||
{
|
||||
return "/sbin/newfs_apfs";
|
||||
}
|
||||
|
||||
void CoreService::RequestExecuteMacOSXAPFSFormatter (const DevicePath &devicePath, uint64 userId, uint64 groupId)
|
||||
{
|
||||
ExecuteMacOSXAPFSFormatterRequest request (devicePath, userId, groupId);
|
||||
SendRequest <ExecuteMacOSXAPFSFormatterResponse> (request);
|
||||
}
|
||||
#endif
|
||||
|
||||
shared_ptr <VolumeInfo> CoreService::RequestMountVolume (MountOptions &options)
|
||||
{
|
||||
MountVolumeRequest request (&options);
|
||||
|
||||
@@ -35,6 +35,10 @@ namespace VeraCrypt
|
||||
static uint32 RequestGetDeviceSectorSize (const DevicePath &devicePath);
|
||||
static uint64 RequestGetDeviceSize (const DevicePath &devicePath);
|
||||
static HostDeviceList RequestGetHostDevices (bool pathListOnly);
|
||||
#ifdef TC_MACOSX
|
||||
static const char *GetMacOSXAPFSFormatterPath ();
|
||||
static void RequestExecuteMacOSXAPFSFormatter (const DevicePath &devicePath, uint64 userId, uint64 groupId);
|
||||
#endif
|
||||
static shared_ptr <VolumeInfo> RequestMountVolume (MountOptions &options);
|
||||
static void RequestSetFileOwner (const FilesystemPath &path, const UserId &owner);
|
||||
static void SetAdminPasswordCallback (shared_ptr <GetStringFunctor> functor) { AdminPasswordCallback = functor; }
|
||||
|
||||
@@ -219,6 +219,32 @@ namespace VeraCrypt
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
}
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
// ExecuteMacOSXAPFSFormatterRequest
|
||||
void ExecuteMacOSXAPFSFormatterRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
Serializer sr (stream);
|
||||
Device = sr.DeserializeWString ("Device");
|
||||
sr.Deserialize ("OwnerGroupId", OwnerGroupId);
|
||||
sr.Deserialize ("OwnerUserId", OwnerUserId);
|
||||
}
|
||||
|
||||
bool ExecuteMacOSXAPFSFormatterRequest::RequiresElevation () const
|
||||
{
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void ExecuteMacOSXAPFSFormatterRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("Device", wstring (Device));
|
||||
sr.Serialize ("OwnerGroupId", OwnerGroupId);
|
||||
sr.Serialize ("OwnerUserId", OwnerUserId);
|
||||
}
|
||||
#endif
|
||||
|
||||
// MountVolumeRequest
|
||||
void MountVolumeRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
{
|
||||
@@ -294,6 +320,9 @@ namespace VeraCrypt
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (EmergencyDismountVolumeRequest);
|
||||
#endif
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (ExitRequest);
|
||||
#ifdef TC_MACOSX
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (ExecuteMacOSXAPFSFormatterRequest);
|
||||
#endif
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (GetDeviceSectorSizeRequest);
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (GetDeviceSizeRequest);
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (GetHostDevicesRequest);
|
||||
|
||||
@@ -126,6 +126,22 @@ namespace VeraCrypt
|
||||
TC_SERIALIZABLE (ExitRequest);
|
||||
};
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
struct ExecuteMacOSXAPFSFormatterRequest : CoreServiceRequest
|
||||
{
|
||||
ExecuteMacOSXAPFSFormatterRequest () { }
|
||||
ExecuteMacOSXAPFSFormatterRequest (const DevicePath &devicePath, uint64 userId, uint64 groupId)
|
||||
: Device (devicePath), OwnerGroupId (groupId), OwnerUserId (userId) { }
|
||||
TC_SERIALIZABLE (ExecuteMacOSXAPFSFormatterRequest);
|
||||
|
||||
virtual bool RequiresElevation () const;
|
||||
|
||||
DevicePath Device;
|
||||
uint64 OwnerGroupId;
|
||||
uint64 OwnerUserId;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct MountVolumeRequest : CoreServiceRequest
|
||||
{
|
||||
MountVolumeRequest () { }
|
||||
|
||||
@@ -88,6 +88,18 @@ namespace VeraCrypt
|
||||
Serializable::SerializeList (stream, HostDevices);
|
||||
}
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
// ExecuteMacOSXAPFSFormatterResponse
|
||||
void ExecuteMacOSXAPFSFormatterResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
{
|
||||
}
|
||||
|
||||
void ExecuteMacOSXAPFSFormatterResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
}
|
||||
#endif
|
||||
|
||||
// MountVolumeResponse
|
||||
void MountVolumeResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
{
|
||||
@@ -118,6 +130,9 @@ namespace VeraCrypt
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (GetDeviceSectorSizeResponse);
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (GetDeviceSizeResponse);
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (GetHostDevicesResponse);
|
||||
#ifdef TC_MACOSX
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (ExecuteMacOSXAPFSFormatterResponse);
|
||||
#endif
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (MountVolumeResponse);
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (SetFileOwnerResponse);
|
||||
}
|
||||
|
||||
@@ -69,6 +69,14 @@ namespace VeraCrypt
|
||||
HostDeviceList HostDevices;
|
||||
};
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
struct ExecuteMacOSXAPFSFormatterResponse : CoreServiceResponse
|
||||
{
|
||||
ExecuteMacOSXAPFSFormatterResponse () { }
|
||||
TC_SERIALIZABLE (ExecuteMacOSXAPFSFormatterResponse);
|
||||
};
|
||||
#endif
|
||||
|
||||
struct MountVolumeResponse : CoreServiceResponse
|
||||
{
|
||||
MountVolumeResponse () { }
|
||||
|
||||
@@ -594,7 +594,7 @@ namespace VeraCrypt
|
||||
|
||||
mountedVol->AuxMountPoint = mf.MountPoint;
|
||||
|
||||
if (!mountedVol->VirtualDevice.IsEmpty())
|
||||
if (mountedVol->MountPoint.IsEmpty() && !mountedVol->VirtualDevice.IsEmpty())
|
||||
{
|
||||
MountedFilesystemList mpl = GetMountedFilesystems (mountedVol->VirtualDevice);
|
||||
|
||||
@@ -602,6 +602,9 @@ namespace VeraCrypt
|
||||
mountedVol->MountPoint = mpl.front()->MountPoint;
|
||||
}
|
||||
|
||||
if (mountedVol->MountPoint.IsEmpty() || mountedVol->VirtualDevice.IsEmpty())
|
||||
UpdateMountedVolumeInfo (mountedVol);
|
||||
|
||||
volumes.push_back (mountedVol);
|
||||
|
||||
if (!volumePath.IsEmpty())
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace VeraCrypt
|
||||
virtual void MountFilesystem (const DevicePath &devicePath, const DirectoryPath &mountPoint, const string &filesystemType, bool readOnly, const string &systemMountOptions) const;
|
||||
virtual DevicePath MountAuxVolumeImage (const DirectoryPath &auxMountPoint, const MountOptions &options) const;
|
||||
virtual void MountVolumeNative (shared_ptr <Volume> volume, MountOptions &options, const DirectoryPath &auxMountPoint) const { throw NotApplicable (SRC_POS); }
|
||||
virtual void UpdateMountedVolumeInfo (shared_ptr <VolumeInfo> mountedVolume) const { (void) mountedVolume; }
|
||||
#ifdef TC_LINUX
|
||||
string DetectFilesystemType (const DevicePath &devicePath) const;
|
||||
#endif
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace VeraCrypt
|
||||
static bool ExtractPlistString (const string &xml, const string &key, size_t start, size_t limit, string &value, size_t *endPos = nullptr)
|
||||
{
|
||||
// hdiutil currently emits simple <key>name</key><string>value</string> pairs.
|
||||
// This lightweight parser assumes the value follows the requested key.
|
||||
string keyTag = "<key>" + key + "</key>";
|
||||
size_t p = xml.find (keyTag, start);
|
||||
if (p == string::npos || p >= limit)
|
||||
@@ -124,7 +125,64 @@ namespace VeraCrypt
|
||||
return normalized;
|
||||
}
|
||||
|
||||
static DevicePath FindVirtualDeviceByImagePath (const string &imagePath)
|
||||
static bool ExtractDiskImageDeviceAndMountPoint (const string &xml, size_t start, size_t limit, DevicePath &device, DirectoryPath &mountPoint)
|
||||
{
|
||||
string firstDevice;
|
||||
string mountedDevice;
|
||||
string mountedPath;
|
||||
|
||||
for (size_t p = start; ; )
|
||||
{
|
||||
size_t devKeyPos = xml.find ("<key>dev-entry</key>", p);
|
||||
if (devKeyPos == string::npos || devKeyPos >= limit)
|
||||
break;
|
||||
|
||||
string devEntry;
|
||||
size_t devValueEnd = 0;
|
||||
if (!ExtractPlistString (xml, "dev-entry", devKeyPos, limit, devEntry, &devValueEnd))
|
||||
{
|
||||
p = devKeyPos + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
devEntry = StringConverter::Trim (devEntry);
|
||||
if (firstDevice.empty())
|
||||
firstDevice = devEntry;
|
||||
|
||||
size_t nextDevKeyPos = xml.find ("<key>dev-entry</key>", devValueEnd);
|
||||
if (nextDevKeyPos == string::npos || nextDevKeyPos > limit)
|
||||
nextDevKeyPos = limit;
|
||||
|
||||
string currentMountPoint;
|
||||
// hdiutil currently emits dev-entry before mount-point inside each entity.
|
||||
if (ExtractPlistString (xml, "mount-point", devValueEnd, nextDevKeyPos, currentMountPoint)
|
||||
&& !currentMountPoint.empty())
|
||||
{
|
||||
mountedDevice = devEntry;
|
||||
mountedPath = currentMountPoint;
|
||||
break;
|
||||
}
|
||||
|
||||
p = devValueEnd;
|
||||
}
|
||||
|
||||
if (!mountedDevice.empty())
|
||||
{
|
||||
device = mountedDevice;
|
||||
mountPoint = mountedPath;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!firstDevice.empty())
|
||||
{
|
||||
device = firstDevice;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool FindDiskImageInfoByImagePath (const string &imagePath, DevicePath &device, DirectoryPath &mountPoint)
|
||||
{
|
||||
list <string> args;
|
||||
args.push_back ("info");
|
||||
@@ -150,15 +208,13 @@ namespace VeraCrypt
|
||||
size_t nextImageKeyPos = xml.find ("<key>image-path</key>", imageValueEnd);
|
||||
if (NormalizeDiskImagePath (currentImagePath) == normalizedImagePath)
|
||||
{
|
||||
string devEntry;
|
||||
if (ExtractPlistString (xml, "dev-entry", imageValueEnd, nextImageKeyPos, devEntry))
|
||||
return StringConverter::Trim (devEntry);
|
||||
return ExtractDiskImageDeviceAndMountPoint (xml, imageValueEnd, nextImageKeyPos, device, mountPoint);
|
||||
}
|
||||
|
||||
p = imageValueEnd;
|
||||
}
|
||||
|
||||
return DevicePath();
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool AuxiliaryControlFileHasVirtualDevice (const DirectoryPath &auxMountPoint, const DevicePath &virtualDev, int retryCount = 50)
|
||||
@@ -198,13 +254,11 @@ namespace VeraCrypt
|
||||
|
||||
shared_ptr <VolumeInfo> CoreMacOSX::DismountVolume (shared_ptr <VolumeInfo> mountedVolume, bool ignoreOpenFiles, bool syncVolumeInfo)
|
||||
{
|
||||
if (mountedVolume->VirtualDevice.IsEmpty() && !mountedVolume->AuxMountPoint.IsEmpty())
|
||||
if (!mountedVolume->AuxMountPoint.IsEmpty())
|
||||
{
|
||||
try
|
||||
{
|
||||
DevicePath recoveredVirtualDevice = FindVirtualDeviceByImagePath (string (mountedVolume->AuxMountPoint) + FuseService::GetVolumeImagePath());
|
||||
if (!recoveredVirtualDevice.IsEmpty())
|
||||
mountedVolume->VirtualDevice = recoveredVirtualDevice;
|
||||
UpdateMountedVolumeInfo (mountedVolume);
|
||||
}
|
||||
catch (...) { }
|
||||
}
|
||||
@@ -277,6 +331,45 @@ namespace VeraCrypt
|
||||
return mountedVolume;
|
||||
}
|
||||
|
||||
void CoreMacOSX::UpdateMountedVolumeInfo (shared_ptr <VolumeInfo> mountedVolume) const
|
||||
{
|
||||
if (!mountedVolume || mountedVolume->AuxMountPoint.IsEmpty())
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
DevicePath recoveredVirtualDevice;
|
||||
DirectoryPath recoveredMountPoint;
|
||||
|
||||
if (FindDiskImageInfoByImagePath (string (mountedVolume->AuxMountPoint) + FuseService::GetVolumeImagePath(), recoveredVirtualDevice, recoveredMountPoint))
|
||||
{
|
||||
if (!recoveredVirtualDevice.IsEmpty())
|
||||
{
|
||||
if (mountedVolume->VirtualDevice != recoveredVirtualDevice && recoveredMountPoint.IsEmpty())
|
||||
mountedVolume->MountPoint = DirectoryPath();
|
||||
|
||||
mountedVolume->VirtualDevice = recoveredVirtualDevice;
|
||||
}
|
||||
|
||||
if (!recoveredMountPoint.IsEmpty())
|
||||
mountedVolume->MountPoint = recoveredMountPoint;
|
||||
}
|
||||
}
|
||||
catch (...) { }
|
||||
|
||||
if (mountedVolume->MountPoint.IsEmpty() && !mountedVolume->VirtualDevice.IsEmpty())
|
||||
{
|
||||
try
|
||||
{
|
||||
MountedFilesystemList mountedFilesystems = GetMountedFilesystems (mountedVolume->VirtualDevice);
|
||||
|
||||
if (mountedFilesystems.size() > 0)
|
||||
mountedVolume->MountPoint = mountedFilesystems.front()->MountPoint;
|
||||
}
|
||||
catch (...) { }
|
||||
}
|
||||
}
|
||||
|
||||
void CoreMacOSX::CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair) const
|
||||
{
|
||||
list <string> args;
|
||||
@@ -378,20 +471,12 @@ namespace VeraCrypt
|
||||
}
|
||||
}
|
||||
|
||||
size_t p = xml.find ("<key>dev-entry</key>");
|
||||
if (p == string::npos)
|
||||
DevicePath virtualDev;
|
||||
DirectoryPath mountPoint;
|
||||
if (!ExtractDiskImageDeviceAndMountPoint (xml, 0, string::npos, virtualDev, mountPoint)
|
||||
|| virtualDev.IsEmpty())
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
|
||||
p = xml.find ("<string>", p);
|
||||
if (p == string::npos)
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
p += 8;
|
||||
|
||||
size_t e = xml.find ("</string>", p);
|
||||
if (e == string::npos)
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
|
||||
DevicePath virtualDev = StringConverter::Trim (xml.substr (p, e - p));
|
||||
(void) mountPoint;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace VeraCrypt
|
||||
|
||||
protected:
|
||||
virtual DevicePath MountAuxVolumeImage (const DirectoryPath &auxMountPoint, const MountOptions &options) const;
|
||||
virtual void UpdateMountedVolumeInfo (shared_ptr <VolumeInfo> mountedVolume) const;
|
||||
|
||||
private:
|
||||
CoreMacOSX (const CoreMacOSX &);
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
#include "Core/VolumeCreator.h"
|
||||
#include "Main/Application.h"
|
||||
#include "Main/GraphicUserInterface.h"
|
||||
#ifdef TC_MACOSX
|
||||
#include "Main/MacOSXFormatterDevice.h"
|
||||
#endif
|
||||
#include "Main/Resources.h"
|
||||
#include "VolumeCreationWizard.h"
|
||||
#include "EncryptionOptionsWizardPage.h"
|
||||
@@ -194,20 +197,6 @@ namespace VeraCrypt
|
||||
return path;
|
||||
}
|
||||
|
||||
static string GetMacOSXRawDevicePath (const string &deviceIdentifier)
|
||||
{
|
||||
if (deviceIdentifier.find ("/dev/rdisk") == 0)
|
||||
return deviceIdentifier;
|
||||
|
||||
if (deviceIdentifier.find ("/dev/disk") == 0)
|
||||
return string ("/dev/r") + deviceIdentifier.substr (5);
|
||||
|
||||
if (deviceIdentifier.find ("disk") == 0)
|
||||
return string ("/dev/r") + deviceIdentifier;
|
||||
|
||||
return deviceIdentifier;
|
||||
}
|
||||
|
||||
static string GetMacOSXDiskutilInfo (const VolumePath &devicePath)
|
||||
{
|
||||
list <string> args;
|
||||
@@ -844,14 +833,22 @@ namespace VeraCrypt
|
||||
Thread::Sleep (2000); // Try to prevent race conditions caused by OS
|
||||
|
||||
// Temporarily take ownership of the device if the user is not an administrator
|
||||
UserId origDeviceOwner ((uid_t) -1);
|
||||
|
||||
DevicePath virtualDevice = volume->VirtualDevice;
|
||||
#ifdef TC_MACOSX
|
||||
string virtualDeviceStr = virtualDevice;
|
||||
if (virtualDeviceStr.find ("/dev/rdisk") != 0)
|
||||
virtualDevice = "/dev/r" + virtualDeviceStr.substr (5);
|
||||
#endif
|
||||
virtualDevice = GetMacOSXRawDevicePath (virtualDeviceStr);
|
||||
|
||||
MacOSXFormatterDeviceOwnerRestoreList changedDeviceOwners;
|
||||
finally_do_arg (MacOSXFormatterDeviceOwnerRestoreList *, &changedDeviceOwners,
|
||||
{
|
||||
RestoreMacOSXFormatterDeviceOwners (*finally_arg);
|
||||
});
|
||||
bool useElevatedAPFSFormatter = UseElevatedMacOSXAPFSFormatter (fsFormatter);
|
||||
if (!useElevatedAPFSFormatter)
|
||||
PrepareMacOSXFormatterDevice (virtualDevice, changedDeviceOwners);
|
||||
#else
|
||||
UserId origDeviceOwner ((uid_t) -1);
|
||||
|
||||
try
|
||||
{
|
||||
File file;
|
||||
@@ -871,6 +868,7 @@ namespace VeraCrypt
|
||||
if (finally_arg2.SystemId != (uid_t) -1)
|
||||
Core->SetFileOwner (finally_arg, finally_arg2);
|
||||
});
|
||||
#endif
|
||||
|
||||
// Create filesystem
|
||||
list <string> args;
|
||||
@@ -892,10 +890,19 @@ namespace VeraCrypt
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
if (IsMacOSXAPFSFormatter (fsFormatter) && !useElevatedAPFSFormatter)
|
||||
AddMacOSXAPFSFormatterUserArgs (args);
|
||||
#endif
|
||||
|
||||
args.push_back (string (virtualDevice));
|
||||
|
||||
SetCreationProgressText (StringFormatter (LangString["FORMAT_STAGE_CREATING_FILESYSTEM"], fsFormatter));
|
||||
#ifdef TC_MACOSX
|
||||
ExecuteMacOSXFilesystemFormatter (fsFormatter, args);
|
||||
#else
|
||||
Process::Execute (fsFormatter, args);
|
||||
#endif
|
||||
SetCreationProgressText (LangString["FORMAT_STAGE_DISMOUNTING_TEMP_VOLUME"]);
|
||||
}
|
||||
#endif // TC_UNIX
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
VeraCrypt source code
|
||||
Copyright (c) 2026 AM Crypto
|
||||
|
||||
This file is part of VeraCrypt and is governed by the Apache License 2.0
|
||||
the full text of which is contained in the file License.txt included in
|
||||
VeraCrypt binary and source code distribution packages.
|
||||
*/
|
||||
|
||||
#ifndef VC_HEADER_Main_MacOSXFormatterDevice
|
||||
#define VC_HEADER_Main_MacOSXFormatterDevice
|
||||
|
||||
#include "Main/Main.h"
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
#include <unistd.h>
|
||||
#include "Core/Unix/CoreService.h"
|
||||
#include "Platform/Unix/Process.h"
|
||||
|
||||
namespace VeraCrypt
|
||||
{
|
||||
inline bool IsMacOSXDiskDevicePath (const string &deviceIdentifier, const string &prefix)
|
||||
{
|
||||
return deviceIdentifier.find (prefix) == 0
|
||||
&& deviceIdentifier.size() > prefix.size()
|
||||
&& deviceIdentifier[prefix.size()] >= '0'
|
||||
&& deviceIdentifier[prefix.size()] <= '9';
|
||||
}
|
||||
|
||||
inline string GetMacOSXRawDevicePath (const string &deviceIdentifier)
|
||||
{
|
||||
if (IsMacOSXDiskDevicePath (deviceIdentifier, "/dev/rdisk"))
|
||||
return deviceIdentifier;
|
||||
|
||||
if (IsMacOSXDiskDevicePath (deviceIdentifier, "/dev/disk"))
|
||||
return string ("/dev/rdisk") + deviceIdentifier.substr (9);
|
||||
|
||||
if (IsMacOSXDiskDevicePath (deviceIdentifier, "rdisk"))
|
||||
return string ("/dev/") + deviceIdentifier;
|
||||
|
||||
if (IsMacOSXDiskDevicePath (deviceIdentifier, "disk"))
|
||||
return string ("/dev/r") + deviceIdentifier;
|
||||
|
||||
return deviceIdentifier;
|
||||
}
|
||||
|
||||
inline string GetMacOSXBlockDevicePath (const string &deviceIdentifier)
|
||||
{
|
||||
if (IsMacOSXDiskDevicePath (deviceIdentifier, "/dev/disk"))
|
||||
return deviceIdentifier;
|
||||
|
||||
if (IsMacOSXDiskDevicePath (deviceIdentifier, "/dev/rdisk"))
|
||||
return string ("/dev/disk") + deviceIdentifier.substr (10);
|
||||
|
||||
if (IsMacOSXDiskDevicePath (deviceIdentifier, "disk"))
|
||||
return string ("/dev/") + deviceIdentifier;
|
||||
|
||||
if (IsMacOSXDiskDevicePath (deviceIdentifier, "rdisk"))
|
||||
return string ("/dev/disk") + deviceIdentifier.substr (5);
|
||||
|
||||
return deviceIdentifier;
|
||||
}
|
||||
|
||||
inline bool IsMacOSXAPFSFormatter (const string &fsFormatter)
|
||||
{
|
||||
size_t namePos = fsFormatter.find_last_of ('/');
|
||||
string fsFormatterName = namePos == string::npos ? fsFormatter : fsFormatter.substr (namePos + 1);
|
||||
return fsFormatterName == "newfs_apfs";
|
||||
}
|
||||
|
||||
inline bool UseElevatedMacOSXAPFSFormatter (const string &fsFormatter)
|
||||
{
|
||||
return IsMacOSXAPFSFormatter (fsFormatter) && !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
inline void AddMacOSXAPFSFormatterUserArgs (list <string> &args)
|
||||
{
|
||||
stringstream uid;
|
||||
stringstream gid;
|
||||
|
||||
// The APFS formatter may run elevated, so preserve the invoking user's ownership.
|
||||
uid << getuid();
|
||||
gid << getgid();
|
||||
|
||||
args.push_back ("-U");
|
||||
args.push_back (uid.str());
|
||||
args.push_back ("-G");
|
||||
args.push_back (gid.str());
|
||||
}
|
||||
|
||||
struct MacOSXFormatterDeviceOwnerRestore
|
||||
{
|
||||
MacOSXFormatterDeviceOwnerRestore (const FilesystemPath &path, const UserId &owner)
|
||||
: Path (path), Owner (owner) { }
|
||||
|
||||
FilesystemPath Path;
|
||||
UserId Owner;
|
||||
};
|
||||
|
||||
typedef list <MacOSXFormatterDeviceOwnerRestore> MacOSXFormatterDeviceOwnerRestoreList;
|
||||
|
||||
inline void AddUniqueMacOSXDevicePath (list <FilesystemPath> &paths, const string &path)
|
||||
{
|
||||
if (path.empty())
|
||||
return;
|
||||
|
||||
foreach (const FilesystemPath &existingPath, paths)
|
||||
{
|
||||
if (string (existingPath) == path)
|
||||
return;
|
||||
}
|
||||
|
||||
paths.push_back (FilesystemPath (path));
|
||||
}
|
||||
|
||||
inline void PrepareMacOSXFormatterDevice (const DevicePath &devicePath, MacOSXFormatterDeviceOwnerRestoreList &changedDeviceOwners)
|
||||
{
|
||||
if (Core->HasAdminPrivileges())
|
||||
return;
|
||||
|
||||
const string devicePathStr = devicePath;
|
||||
list <FilesystemPath> paths;
|
||||
// APFS formatters may resolve /dev/rdiskN back to /dev/diskN internally.
|
||||
AddUniqueMacOSXDevicePath (paths, devicePathStr);
|
||||
AddUniqueMacOSXDevicePath (paths, GetMacOSXRawDevicePath (devicePathStr));
|
||||
AddUniqueMacOSXDevicePath (paths, GetMacOSXBlockDevicePath (devicePathStr));
|
||||
|
||||
foreach (const FilesystemPath &path, paths)
|
||||
{
|
||||
try
|
||||
{
|
||||
File file;
|
||||
file.Open (path, File::OpenReadWrite);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
UserId origDeviceOwner = path.GetOwner();
|
||||
// Register before chown so service-side success followed by
|
||||
// an IPC failure can still be restored.
|
||||
changedDeviceOwners.push_back (MacOSXFormatterDeviceOwnerRestore (path, origDeviceOwner));
|
||||
Core->SetFileOwner (path, UserId (getuid()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void RestoreMacOSXFormatterDeviceOwners (const MacOSXFormatterDeviceOwnerRestoreList &changedDeviceOwners)
|
||||
{
|
||||
foreach (const MacOSXFormatterDeviceOwnerRestore &restore, changedDeviceOwners)
|
||||
{
|
||||
try
|
||||
{
|
||||
Core->SetFileOwner (restore.Path, restore.Owner);
|
||||
}
|
||||
catch (...) { }
|
||||
}
|
||||
}
|
||||
|
||||
inline void ExecuteMacOSXFilesystemFormatter (const string &fsFormatter, const list <string> &args)
|
||||
{
|
||||
if (UseElevatedMacOSXAPFSFormatter (fsFormatter))
|
||||
{
|
||||
if (args.empty())
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
|
||||
CoreService::RequestExecuteMacOSXAPFSFormatter (DevicePath (args.back()), getuid(), getgid());
|
||||
return;
|
||||
}
|
||||
|
||||
Process::Execute (IsMacOSXAPFSFormatter (fsFormatter) ? CoreService::GetMacOSXAPFSFormatterPath() : fsFormatter, args);
|
||||
}
|
||||
}
|
||||
#endif // TC_MACOSX
|
||||
|
||||
#endif // VC_HEADER_Main_MacOSXFormatterDevice
|
||||
@@ -26,6 +26,9 @@
|
||||
#include "Common/EMVToken.h"
|
||||
#include "Core/RandomNumberGenerator.h"
|
||||
#include "Application.h"
|
||||
#ifdef TC_MACOSX
|
||||
#include "Main/MacOSXFormatterDevice.h"
|
||||
#endif
|
||||
#include "TextUserInterface.h"
|
||||
|
||||
namespace VeraCrypt
|
||||
@@ -1065,14 +1068,22 @@ namespace VeraCrypt
|
||||
Thread::Sleep (2000); // Try to prevent race conditions caused by OS
|
||||
|
||||
// Temporarily take ownership of the device if the user is not an administrator
|
||||
UserId origDeviceOwner ((uid_t) -1);
|
||||
|
||||
DevicePath virtualDevice = volume->VirtualDevice;
|
||||
#ifdef TC_MACOSX
|
||||
string virtualDeviceStr = virtualDevice;
|
||||
if (virtualDeviceStr.find ("/dev/rdisk") != 0)
|
||||
virtualDevice = "/dev/r" + virtualDeviceStr.substr (5);
|
||||
#endif
|
||||
virtualDevice = GetMacOSXRawDevicePath (virtualDeviceStr);
|
||||
|
||||
MacOSXFormatterDeviceOwnerRestoreList changedDeviceOwners;
|
||||
finally_do_arg (MacOSXFormatterDeviceOwnerRestoreList *, &changedDeviceOwners,
|
||||
{
|
||||
RestoreMacOSXFormatterDeviceOwners (*finally_arg);
|
||||
});
|
||||
bool useElevatedAPFSFormatter = UseElevatedMacOSXAPFSFormatter (fsFormatter);
|
||||
if (!useElevatedAPFSFormatter)
|
||||
PrepareMacOSXFormatterDevice (virtualDevice, changedDeviceOwners);
|
||||
#else
|
||||
UserId origDeviceOwner ((uid_t) -1);
|
||||
|
||||
try
|
||||
{
|
||||
File file;
|
||||
@@ -1092,6 +1103,7 @@ namespace VeraCrypt
|
||||
if (finally_arg2.SystemId != (uid_t) -1)
|
||||
Core->SetFileOwner (finally_arg, finally_arg2);
|
||||
});
|
||||
#endif
|
||||
|
||||
// Create filesystem
|
||||
list <string> args;
|
||||
@@ -1113,9 +1125,18 @@ namespace VeraCrypt
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
if (IsMacOSXAPFSFormatter (fsFormatter) && !useElevatedAPFSFormatter)
|
||||
AddMacOSXAPFSFormatterUserArgs (args);
|
||||
#endif
|
||||
|
||||
args.push_back (string (virtualDevice));
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
ExecuteMacOSXFilesystemFormatter (fsFormatter, args);
|
||||
#else
|
||||
Process::Execute (fsFormatter, args);
|
||||
#endif
|
||||
}
|
||||
#endif // TC_UNIX
|
||||
|
||||
|
||||
Reference in New Issue
Block a user