summaryrefslogtreecommitdiff
blob: 962d0e1f55ef3e0167f6eb78da16ee8cfcab8152 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff -urpN gnome-volume-manager-1.5.1/src/manager.c gnome-volume-manager-1.5.1.az/src/manager.c
--- gnome-volume-manager-1.5.1/src/manager.c	2005-08-25 22:53:51.000000000 +0200
+++ gnome-volume-manager-1.5.1.az/src/manager.c	2005-09-07 22:33:43.000000000 +0200
@@ -47,6 +47,11 @@
 
 #define NAUTILUS_COMMAND	 BIN_NAUTILUS" -n --no-desktop %m"
 
+#define BIN_PMOUNT		 "/usr/bin/pmount-hal"
+#define PMOUNT_COMMAND		 BIN_PMOUNT" %h"
+#define BIN_PUNMOUNT		 "/usr/bin/pumount"
+#define PUNMOUNT_COMMAND	 BIN_PUNMOUNT" %d"
+
 static struct gvm_configuration config;
 static LibHalContext *hal_ctx;
 
@@ -1170,13 +1175,18 @@ gvm_device_mounted (const char *udi)
 static gboolean
 gvm_device_mount (const char *udi, const char *device, const char *mount_point)
 {
+	char *mount_command = MOUNT_COMMAND;
 	char *key;
 	
 	key = g_strdup (udi);
 	g_hash_table_insert (mount_table, key, key);
+
+	/* Only check executable, as suid binaries might not be readable */
+	if (g_file_test (BIN_PMOUNT, G_FILE_TEST_IS_EXECUTABLE))
+		mount_command = PMOUNT_COMMAND;
 	
 	dbg ("mounting %s...\n", udi);
-	if (gvm_run_command (MOUNT_COMMAND, udi, device, mount_point))
+	if (gvm_run_command (mount_command, udi, device, mount_point))
 		return TRUE;
 	
 	dbg ("mount failed: %s\n", udi);
@@ -1194,7 +1204,13 @@ gvm_device_mount (const char *udi, const
 static gboolean
 gvm_device_unmount (const char *udi, const char *device, const char *mount_point)
 {
-	return gvm_run_command (UNMOUNT_COMMAND, udi, device, mount_point);
+	char *unmount_command = UNMOUNT_COMMAND;
+	
+	/* Only check executable, as suid binaries might not be readable */
+	if (g_file_test (BIN_PUNMOUNT, G_FILE_TEST_IS_EXECUTABLE))
+		unmount_command = PUNMOUNT_COMMAND;
+	
+	return gvm_run_command (unmount_command, udi, device, mount_point);
 }
 
 /*