From 89540fedd84d91580284c166856bf8266b179053 Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Sun, 4 Dec 2016 10:47:18 +0000 Subject: [PATCH] Add bug checks into copy operation methods (#774818) Ensure pre-condition of never being passed a Partition object containing an open LUKS encryption mapping is met for copy operation related methods. Bug 774818 - Implement LUKS read-write actions NOT requiring a passphrase --- src/GParted_Core.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index a152338d..e29ed6bb 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -3013,6 +3013,21 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src, Partition & partition_dst, OperationDetail & operationdetail ) { + if ( partition_src.filesystem == FS_LUKS && partition_src.busy ) + { + operationdetail.add_child( OperationDetail( + GPARTED_BUG + ": " + _("source partition contains open LUKS encryption for a file system copy only step"), + STATUS_ERROR, FONT_ITALIC ) ); + return false; + } + if ( partition_dst.filesystem == FS_LUKS && partition_dst.busy ) + { + operationdetail.add_child( OperationDetail( + GPARTED_BUG + ": " + _("destination partition contains open LUKS encryption for a file system copy only step"), + STATUS_ERROR, FONT_ITALIC ) ); + return false; + } + operationdetail.add_child( OperationDetail( String::ucompose( _("copy file system from %1 to %2"), partition_src.get_path(),