Do not allow setting LUKS labels when crypt is closed.

This commit is contained in:
Andrius Štikonas 2016-05-10 02:20:37 +01:00
parent 64b0cf4c77
commit 0031f84315
2 changed files with 4 additions and 1 deletions

View File

@ -86,7 +86,7 @@ bool luks::supportToolFound() const
{
m_cryptsetupFound =
m_GetLabel != cmdSupportNone &&
m_SetLabel != cmdSupportNone &&
// m_SetLabel != cmdSupportNone && (only m_innerFs labels are supported)
m_Create != cmdSupportNone &&
m_Check != cmdSupportNone &&
m_UpdateUUID != cmdSupportNone &&
@ -310,6 +310,7 @@ bool luks::cryptClose(const QString& deviceNode)
m_passphrase.clear();
setLabel({});
m_SetLabel = cmdSupportNone;
setUUID(readUUID(deviceNode));
setSectorsUsed(-1);
@ -326,6 +327,7 @@ void luks::loadInnerFileSystem(const QString& mapperNode)
FileSystem::Type innerFsType = detectFileSystem(mapperNode);
m_innerFs = FileSystemFactory::cloneWithNewType(innerFsType,
*this);
m_SetLabel = cmdSupportFileSystem;
setLabel(m_innerFs->readLabel(mapperNode));
setUUID(m_innerFs->readUUID(mapperNode));
if (m_innerFs->supportGetUsed() == FileSystem::cmdSupportFileSystem) // FIXME:also implement checking space if partition is mounted

View File

@ -379,6 +379,7 @@ void LibPartedBackend::scanDevicePartitions(Device& d, PedDisk* pedDisk)
// in helpers.h for convenience.
mounted = isMounted(mapperNode);
} else {
luksFs->m_SetLabel = FileSystem::cmdSupportNone;
mounted = false;
}