[gparted] Report LUKS unlock errors into the password dialog (#795617)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Report LUKS unlock errors into the password dialog (#795617)
- Date: Mon, 30 Apr 2018 18:42:55 +0000 (UTC)
commit 1bbb81f920ac50693ea65498d6661a651055c2d0
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Mon Mar 26 07:55:19 2018 +0100
Report LUKS unlock errors into the password dialog (#795617)
Reports generic GParted error "Failed to open LUKS encryption" on any
failure unlocking the partition. Choosing not to display cryptsetup
reported errors because those messages and their translations are not
under GParted control.
Bug 795617 - Implement opening and closing of LUKS mappings
include/DialogPasswordEntry.h | 4 ++++
src/DialogPasswordEntry.cc | 9 +++++++++
src/Win_GParted.cc | 7 ++++---
3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/include/DialogPasswordEntry.h b/include/DialogPasswordEntry.h
index 367913d..1936eaf 100644
--- a/include/DialogPasswordEntry.h
+++ b/include/DialogPasswordEntry.h
@@ -20,7 +20,9 @@
#include "Partition.h"
#include <gtkmm/dialog.h>
+#include <glibmm/ustring.h>
#include <gtkmm/entry.h>
+#include <gtkmm/label.h>
namespace GParted
{
@@ -31,9 +33,11 @@ public:
DialogPasswordEntry( const Partition & partition );
~DialogPasswordEntry();
const char * get_password();
+ void set_error_message( const Glib::ustring & message );
private:
Gtk::Entry *entry;
+ Gtk::Label *error_message;
};
} //GParted
diff --git a/src/DialogPasswordEntry.cc b/src/DialogPasswordEntry.cc
index 73f8839..e1f9409 100644
--- a/src/DialogPasswordEntry.cc
+++ b/src/DialogPasswordEntry.cc
@@ -59,6 +59,10 @@ DialogPasswordEntry::DialogPasswordEntry( const Partition & partition )
// Line 3: blank
vbox->pack_start( *Utils::mk_label( "" ) );
+ // Line 4: error message
+ error_message = Utils::mk_label( "" );
+ vbox->pack_start( *error_message );
+
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
this->add_button( _("Unlock"), Gtk::RESPONSE_OK );
this->set_default_response( Gtk::RESPONSE_OK );
@@ -77,4 +81,9 @@ const char * DialogPasswordEntry::get_password()
return (const char *)gtk_entry_get_text( GTK_ENTRY( entry->gobj() ) );
}
+void DialogPasswordEntry::set_error_message( const Glib::ustring & message )
+{
+ error_message->set_label( message );
+}
+
} //GParted
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 273a950..69d93f9 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -2441,8 +2441,8 @@ bool Win_GParted::open_encrypted_partition( const Partition & partition,
pw = entered_password;
if ( strlen( pw ) == 0 )
{
- // Internal documentation message never shown to user.
- message = "Invalid zero length password";
+ // "cryptsetup" won't accept a zero length password.
+ message = "";
return false;
}
}
@@ -2488,7 +2488,7 @@ bool Win_GParted::open_encrypted_partition( const Partition & partition,
PasswordRAMStore::erase( partition.uuid );
}
- message = "<i># " + cmd + "\n" + error + "\n" + output + "</i>";
+ message = ( success ) ? "" : _("Failed to open LUKS encryption");
return success;
}
@@ -2565,6 +2565,7 @@ void Win_GParted::toggle_crypt_busy_state()
success = open_encrypted_partition( *selected_partition_ptr,
dialog.get_password(),
error_msg );
+ dialog.set_error_message( error_msg );
} while ( ! success );
}
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]