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
This commit is contained in:
parent
3d49fdc2e4
commit
1bbb81f920
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue