From b896a2abf3ee8d9bd5ca9e32089ca50029dcafcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Wed, 18 May 2016 13:46:59 +0100 Subject: [PATCH] Do not allow to resize/mode newly created luks partitions. --- src/ops/resizeoperation.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ops/resizeoperation.cpp b/src/ops/resizeoperation.cpp index 5bf4b30..eda1019 100644 --- a/src/ops/resizeoperation.cpp +++ b/src/ops/resizeoperation.cpp @@ -323,7 +323,7 @@ bool ResizeOperation::canGrow(const Partition* p) return false; // we can always grow, shrink or move a partition not yet written to disk - if (p->state() == Partition::StateNew) + if (p->state() == Partition::StateNew && !p->roles().has(PartitionRole::Luks)) return true; if (p->isMounted()) @@ -342,7 +342,7 @@ bool ResizeOperation::canShrink(const Partition* p) return false; // we can always grow, shrink or move a partition not yet written to disk - if (p->state() == Partition::StateNew) + if (p->state() == Partition::StateNew && !p->roles().has(PartitionRole::Luks)) return true; if (p->state() == Partition::StateCopy) @@ -365,7 +365,8 @@ bool ResizeOperation::canMove(const Partition* p) // we can always grow, shrink or move a partition not yet written to disk if (p->state() == Partition::StateNew) - return true; + // too many bad things can happen for LUKS partitions + return p->roles().has(PartitionRole::Luks) ? false : true; if (p->isMounted()) return false;