Bug 231841 - Multiple encrypted partitions: password prompt needs additional info
Multiple encrypted partitions: password prompt needs additional info
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: gnome-mount (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: David Zeuthen
bzcl34nup
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-12 10:51 EDT by Tom London
Modified: 2013-03-05 22:49 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-04-16 18:28:57 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
dialog box with added device file name (22.71 KB, image/png)
2008-04-13 14:18 EDT, Tom London
no flags Details

  None (edit)
Description Tom London 2007-03-12 10:51:19 EDT
Description of problem:
gnome-mount prompts for LUKS passphrases, YEA!!!!

However, if I insert a USB drive with multiple encrypted partitions, I get
multiple passphrase dialog boxes, none of which indicate which partition they
refer to.

Something in this dialog prompt should indicate what partition... no?

Version-Release number of selected component (if applicable):
gnome-mount-0.5-3.fc7

How reproducible:
Every time

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Bug Zapper 2008-04-03 19:39:57 EDT
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.
Comment 2 Tom London 2008-04-03 19:47:46 EDT
This continues in current Rawhide.

Multiple encrypted partitions provide the identical prompt for passwords: they
do not include partition information, only drive information.
Comment 3 Tom London 2008-04-03 19:48:34 EDT
Thought I clicked "I am providing requested..."
Comment 4 Tom London 2008-04-13 14:17:37 EDT
How about this patch for starters?

--- gnome-mount.c	2008-04-13 11:10:02.000000000 -0700
+++ gnome-mount.c.new	2008-04-13 11:10:56.000000000 -0700
@@ -2230,7 +2230,7 @@
 	notify_parent (TRUE);
 
 	prompt = g_strdup_printf (
-		_("The storage device %s contains encrypted data. Enter a password to
unlock."), drive_name);
+		_("The storage device %s contains encrypted data. Enter a password to unlock
%s."), drive_name, get_dev_file (volume, drive));
 	
 	dialog = gnome_password_dialog_new (_("Unlock Encrypted Data"), prompt, NULL,
NULL, FALSE);
 	g_free (prompt);

Apologize if I have the diff backwards.

I've tested this on my system and this appears to add the dev-name for the Luks
partition being mounted.  This is a start.

I'll attach below a screenshot of the new dialog box.
Comment 5 Tom London 2008-04-13 14:18:36 EDT
Created attachment 302279 [details]
dialog box with added device file name

This is better......
Comment 6 Tom London 2008-04-13 18:24:32 EDT
This patch also includes the device file name in the title bar:

--- gnome-mount.c-old	2008-04-13 11:14:25.000000000 -0700
+++ gnome-mount.c	2008-04-13 15:21:12.000000000 -0700
@@ -2152,6 +2152,7 @@
 	char            *drive_name;
 	char            *result;
 	char            *prompt;
+	char            *title;
 	GtkWidget	*dialog;
 	GnomePasswordDialogRemember remember;
 	char            *keyring_password;
@@ -2230,9 +2231,12 @@
 	notify_parent (TRUE);
 
 	prompt = g_strdup_printf (
-		_("The storage device %s contains encrypted data. Enter a password to
unlock."), drive_name);
+		_("The storage device %s contains encrypted data. Enter a password to unlock
%s."), drive_name, get_dev_file (volume, drive));
 	
-	dialog = gnome_password_dialog_new (_("Unlock Encrypted Data"), prompt, NULL,
NULL, FALSE);
+	title = g_strdup_printf (
+		_("Unlock Encrypted Data for %s"), get_dev_file (volume, drive));
+	dialog = gnome_password_dialog_new (title, prompt, NULL, NULL, FALSE);
+	g_free (title);
 	g_free (prompt);
 
 	gnome_password_dialog_set_show_username (GNOME_PASSWORD_DIALOG (dialog), FALSE);
Comment 7 David Zeuthen 2008-04-13 18:46:38 EDT
I don't think displaying some random device name is very user friendly. Rather,
I think displaying the partition number is a lot better. This is in
volume.partition.number. And remember to check for volume.is_partition==FALSE as
well.
Comment 8 Tom London 2008-04-13 20:05:03 EDT
Thanks for the improvements.

Not sure this is completely good, but....:

--- gnome-mount.c-old	2008-04-13 11:14:25.000000000 -0700
+++ gnome-mount.c	2008-04-13 16:58:54.000000000 -0700
@@ -2152,6 +2152,7 @@
 	char            *drive_name;
 	char            *result;
 	char            *prompt;
+	char            *title;
 	GtkWidget	*dialog;
 	GnomePasswordDialogRemember remember;
 	char            *keyring_password;
@@ -2229,10 +2230,22 @@
 	 */
 	notify_parent (TRUE);
 
-	prompt = g_strdup_printf (
-		_("The storage device %s contains encrypted data. Enter a password to
unlock."), drive_name);
+	if (libhal_volume_is_partition(volume)==FALSE) {
+		prompt = g_strdup_printf (
+			_("The storage device %s contains encrypted data. Enter a password to
unlock."), drive_name);
 	
-	dialog = gnome_password_dialog_new (_("Unlock Encrypted Data"), prompt, NULL,
NULL, FALSE);
+		title = g_strdup (
+			_("Unlock Encrypted Data"));
+	} else {
+		prompt = g_strdup_printf (
+			_("The storage device %s contains encrypted data. Enter a password to unlock
partition %u."), drive_name, libhal_volume_get_partition_number(volume));
+	
+		title = g_strdup_printf (
+			_("Unlock Encrypted Data for partition %d"),
libhal_volume_get_partition_number(volume));
+	}
+
+	dialog = gnome_password_dialog_new (title, prompt, NULL, NULL, FALSE);
+	g_free (title);
 	g_free (prompt);
 
 	gnome_password_dialog_set_show_username (GNOME_PASSWORD_DIALOG (dialog), FALSE);

I'm sure this could be improved by someone more facile with the g_ and libhal_
functions.

The 'if ()' could be replaced by more complicated expressions in the calls to
g_strdup_printf();  not sure of the coding style here.

[The libhal_ functions are pretty neat.....]
Comment 9 Tom London 2008-04-13 20:08:49 EDT
Uhhh... botched the format in one of the g_strdup_printf calls.  %u->%d.

Corrected patch:

--- gnome-mount.c-old	2008-04-13 11:14:25.000000000 -0700
+++ gnome-mount.c	2008-04-13 17:07:01.000000000 -0700
@@ -2152,6 +2152,7 @@
 	char            *drive_name;
 	char            *result;
 	char            *prompt;
+	char            *title;
 	GtkWidget	*dialog;
 	GnomePasswordDialogRemember remember;
 	char            *keyring_password;
@@ -2229,10 +2230,22 @@
 	 */
 	notify_parent (TRUE);
 
-	prompt = g_strdup_printf (
-		_("The storage device %s contains encrypted data. Enter a password to
unlock."), drive_name);
+	if (libhal_volume_is_partition(volume)==FALSE) {
+		prompt = g_strdup_printf (
+			_("The storage device %s contains encrypted data. Enter a password to
unlock."), drive_name);
 	
-	dialog = gnome_password_dialog_new (_("Unlock Encrypted Data"), prompt, NULL,
NULL, FALSE);
+		title = g_strdup (
+			_("Unlock Encrypted Data"));
+	} else {
+		prompt = g_strdup_printf (
+			_("The storage device %s contains encrypted data. Enter a password to unlock
partition %d."), drive_name, libhal_volume_get_partition_number(volume));
+	
+		title = g_strdup_printf (
+			_("Unlock Encrypted Data for partition %d"),
libhal_volume_get_partition_number(volume));
+	}
+
+	dialog = gnome_password_dialog_new (title, prompt, NULL, NULL, FALSE);
+	g_free (title);
 	g_free (prompt);
 
 	gnome_password_dialog_set_show_username (GNOME_PASSWORD_DIALOG (dialog), FALSE);
Comment 10 Tom London 2008-04-14 10:46:35 EDT
I think this cleans up the code flow a bit:

--- gnome-mount.c-old	2008-04-13 11:14:25.000000000 -0700
+++ gnome-mount.c	2008-04-14 07:42:26.000000000 -0700
@@ -2152,6 +2152,8 @@
 	char            *drive_name;
 	char            *result;
 	char            *prompt;
+	char            *partition_string;
+	char            *title;
 	GtkWidget	*dialog;
 	GnomePasswordDialogRemember remember;
 	char            *keyring_password;
@@ -2229,10 +2231,22 @@
 	 */
 	notify_parent (TRUE);
 
+	if (libhal_volume_is_partition(volume)==FALSE) {
+		partition_string = g_strdup ("");
+	} else {
+		partition_string = g_strdup_printf (
+			_(" (partition %d)"), libhal_volume_get_partition_number(volume));
+	}
+
 	prompt = g_strdup_printf (
-		_("The storage device %s contains encrypted data. Enter a password to
unlock."), drive_name);
+		_("The storage device %s%s contains encrypted data. Enter a password to
unlock."), drive_name, partition_string);
 	
-	dialog = gnome_password_dialog_new (_("Unlock Encrypted Data"), prompt, NULL,
NULL, FALSE);
+	title = g_strdup_printf (
+		_("Unlock Encrypted Data%s"), partition_string);
+
+	dialog = gnome_password_dialog_new (title, prompt, NULL, NULL, FALSE);
+	g_free (partition_string);
+	g_free (title);
 	g_free (prompt);
 
 	gnome_password_dialog_set_show_username (GNOME_PASSWORD_DIALOG (dialog), FALSE);
Comment 11 David Zeuthen 2008-04-16 18:28:57 EDT
I committed a slightly more translator friendly patch, see

http://svn.gnome.org/viewvc/gnome-mount/trunk/src/gnome-mount.c?view=log

It seems the diff viewer on svn.g.o is down right now.

Closing as UPSTREAM; I'll make sure this will be in before F9. Thanks.

Note You need to log in before you can comment on or make changes to this bug.