[gparted] Add bug checks into format operation methods (#774818)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Add bug checks into format operation methods (#774818)
- Date: Sat, 14 Jan 2017 15:53:36 +0000 (UTC)
commit 35d57011e912d92ef564870c02b895ca9e7e556d
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sat Dec 3 09:58:40 2016 +0000
Add bug checks into format operation methods (#774818)
Ensure pre-condition of never being passed a Partition object containing
an open LUKS encryption mapping is met for format operation related
methods.
Bug 774818 - Implement LUKS read-write actions NOT requiring a
passphrase
src/GParted_Core.cc | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index ff84391..78fc190 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -2036,6 +2036,14 @@ bool GParted_Core::create_partition( Partition & new_partition, OperationDetail
bool GParted_Core::create_filesystem( const Partition & partition, OperationDetail & operationdetail )
{
+ if ( partition.filesystem == FS_LUKS && partition.busy )
+ {
+ operationdetail.add_child( OperationDetail(
+ GPARTED_BUG + ": " + _("partition contains open LUKS encryption for a create file
system only step"),
+ STATUS_ERROR, FONT_ITALIC ) );
+ return false;
+ }
+
/*TO TRANSLATORS: looks like create new ext3 file system */
operationdetail .add_child( OperationDetail( String::ucompose(
_("create new %1 file system"),
@@ -2067,6 +2075,14 @@ bool GParted_Core::create_filesystem( const Partition & partition, OperationDeta
bool GParted_Core::format( const Partition & partition, OperationDetail & operationdetail )
{
+ if ( partition.filesystem == FS_LUKS && partition.busy )
+ {
+ operationdetail.add_child( OperationDetail(
+ GPARTED_BUG + ": " + _("partition contains open LUKS encryption for a format file
system only step"),
+ STATUS_ERROR, FONT_ITALIC ) );
+ return false;
+ }
+
if ( partition .filesystem == FS_CLEARED )
return erase_filesystem_signatures( partition, operationdetail ) ;
else
@@ -2122,6 +2138,14 @@ bool GParted_Core::delete_partition( const Partition & partition, OperationDetai
bool GParted_Core::remove_filesystem( const Partition & partition, OperationDetail & operationdetail )
{
+ if ( partition.filesystem == FS_LUKS && partition.busy )
+ {
+ operationdetail.add_child( OperationDetail(
+ GPARTED_BUG + ": " + _("partition contains open LUKS encryption for a delete file
system only step"),
+ STATUS_ERROR, FONT_ITALIC ) );
+ return false;
+ }
+
bool success = true ;
FileSystem* p_filesystem = NULL ;
@@ -3570,6 +3594,14 @@ bool GParted_Core::filesystem_resize_disallowed( const Partition & partition )
bool GParted_Core::erase_filesystem_signatures( const Partition & partition, OperationDetail &
operationdetail )
{
+ if ( partition.filesystem == FS_LUKS && partition.busy )
+ {
+ operationdetail.add_child( OperationDetail(
+ GPARTED_BUG + ": " + _("partition contains open LUKS encryption for an erase file
system signatures only step"),
+ STATUS_ERROR, FONT_ITALIC ) );
+ return false;
+ }
+
bool overall_success = false ;
operationdetail .add_child( OperationDetail(
String::ucompose( _("clear old file system signatures in %1"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]