Disallow partition delete operation if the FS is cryptOpen.
This commit is contained in:
parent
12c03cfeff
commit
7ff137233a
|
@ -21,6 +21,7 @@
|
||||||
#include "core/partition.h"
|
#include "core/partition.h"
|
||||||
#include "core/device.h"
|
#include "core/device.h"
|
||||||
#include "core/partitiontable.h"
|
#include "core/partitiontable.h"
|
||||||
|
#include "fs/luks.h"
|
||||||
|
|
||||||
#include "jobs/deletepartitionjob.h"
|
#include "jobs/deletepartitionjob.h"
|
||||||
#include "jobs/deletefilesystemjob.h"
|
#include "jobs/deletefilesystemjob.h"
|
||||||
|
@ -123,5 +124,16 @@ bool DeleteOperation::canDelete(const Partition* p)
|
||||||
if (p->roles().has(PartitionRole::Extended))
|
if (p->roles().has(PartitionRole::Extended))
|
||||||
return p->children().size() == 1 && p->children()[0]->roles().has(PartitionRole::Unallocated);
|
return p->children().size() == 1 && p->children()[0]->roles().has(PartitionRole::Unallocated);
|
||||||
|
|
||||||
|
if (p->roles().has(PartitionRole::Luks))
|
||||||
|
{
|
||||||
|
const FileSystem& fsRef = p->fileSystem();
|
||||||
|
const FS::luks* luksFs = dynamic_cast<const FS::luks*>(&fsRef);
|
||||||
|
if (!luksFs)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (luksFs->isCryptOpen() || luksFs->isMounted())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue