[Utopia] [patch] make g-v-m automount encrypted filesystems



Hey,

Attached is a very simple patch that makes g-v-m call upon it's mount
helper when hal states there's an encrypted file system on a volume.
This works very nicely with gnome-mount (not sure about other mount
helpers, they should Just Work(tm) providing they support mounting
crypted fs).

This patch concludes all the work that W. Michael Petullo and I have
been doing to make handling of LUKS encrypted file system as easy and
painless as possible [1]. It's kinda neat; I'll probably do a screencast
and blog about it tonight.

OK to commit?

 ChangeLog     |    5 +++++
 src/manager.c |   13 +++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

Cheers,
David

[1] : of course, now we need to write some hal methods and some nice UI
to allow unprivileged console users to partition/format (including
setting up LULS encrypted filesystems) their removable drives and media
without knowing hax0r s3cr3ts like what on earth a root password is :-)

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/ChangeLog,v
retrieving revision 1.240
diff -u -p -r1.240 ChangeLog
--- ChangeLog	10 Feb 2006 22:08:25 -0000	1.240
+++ ChangeLog	19 Feb 2006 15:10:48 -0000
@@ -1,3 +1,8 @@
+2006-02-19  David Zeuthen  <davidz redhat com>
+
+	* src/manager.c (mount_all, block_device_added): Support encrypted
+	file systems
+
 2006-02-10  Jeffrey Stedfast  <fejj novell com>
 
 	* configure.in: Bumped version to 1.5.13
Index: src/manager.c
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/manager.c,v
retrieving revision 1.128
diff -u -p -r1.128 manager.c
--- src/manager.c	10 Feb 2006 22:08:25 -0000	1.128
+++ src/manager.c	19 Feb 2006 15:10:50 -0000
@@ -2050,9 +2050,12 @@ block_device_added (const char *udi, con
 	char *fsusage = NULL, *device = NULL, *storage_device = NULL;
 	DBusError error;
 	int mountable;
+	int crypto;
 	
 	dbus_error_init (&error);
-	
+
+	crypto = FALSE;
+
 	/* is this a mountable volume? */
 	if (!(mountable = libhal_device_get_property_bool (hal_ctx, udi, "block.is_volume", NULL))) {
 		dbg ("not a mountable volume: %s\n", udi);
@@ -2065,6 +2068,7 @@ block_device_added (const char *udi, con
 		goto out;
 	}
 	
+
 	if (mountable) {
 		/* only mount if the block device has a sensible filesystem */
 		if (!(fsusage = libhal_device_get_property_string (hal_ctx, udi, "volume.fsusage", &error))) {
@@ -2074,6 +2078,7 @@ block_device_added (const char *udi, con
 			dbg ("encrypted volume found: %s\n", udi);
 			/* TODO: handle encrypted volumes */
 			mountable = FALSE;
+			crypto = TRUE;
 		} else if (strcmp (fsusage, "filesystem") != 0) {
 			dbg ("no sensible filesystem for %s\n", udi);
 			mountable = FALSE;
@@ -2097,7 +2102,7 @@ block_device_added (const char *udi, con
 			goto out;
 	}
 	
-	if (config.automount_drives && mountable) {
+	if (config.automount_drives && (mountable || crypto)) {
 		if (!gvm_udi_is_subfs_mount (udi)) {
 			if (gvm_automount_enabled (udi)) {
 				gvm_device_mount (udi, TRUE);
@@ -2106,7 +2111,7 @@ block_device_added (const char *udi, con
 			}
 		}
 	}
-	
+
  out:
 	
 	if (dbus_error_is_set (&error))
@@ -2666,7 +2671,7 @@ mount_all (LibHalContext *ctx)
 		if (!libhal_device_property_exists (ctx, udi, "volume.fsusage", NULL))
 			continue;
 		prop = libhal_device_get_property_string (ctx, udi, "volume.fsusage", NULL);
-		if (!prop || strcmp (prop, "filesystem") != 0) {
+		if (!prop || ((strcmp (prop, "filesystem") != 0) && (strcmp (prop, "crypto") != 0))) {
 			libhal_free_string (prop);
 			continue;
 		}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]