hal/tools hal-storage-mount.c, 1.6,
1.7 hal-system-storage-cleanup-mountpoints, 1.5, 1.6
David Zeuthen
david at kemper.freedesktop.org
Tue Jun 20 17:44:05 PDT 2006
Update of /cvs/hal/hal/tools
In directory kemper:/tmp/cvs-serv20023/tools
Modified Files:
hal-storage-mount.c hal-system-storage-cleanup-mountpoints
Log Message:
2006-06-20 David Zeuthen <davidz at redhat.com>
* tools/hal-storage-mount.c (bailout_if_in_fstab): Handle LABEL=
and UUID= in this function.
(handle_mount): Also allow uid= on iso9660 and udf like we do for
vfat.
* fdi/policy/10osvendor/20-storage-methods.fdi: Ignore EFI
firmware partition.
* tools/hal-system-storage-cleanup-mountpoints: Fix OS-specific
script invocation
Index: hal-storage-mount.c
===================================================================
RCS file: /cvs/hal/hal/tools/hal-storage-mount.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- hal-storage-mount.c 5 Jun 2006 23:56:00 -0000 1.6
+++ hal-storage-mount.c 21 Jun 2006 00:44:03 -0000 1.7
@@ -295,11 +295,13 @@
}
static void
-bailout_if_in_fstab (const char *device)
+bailout_if_in_fstab (const char *device, const char *label, const char *uuid)
{
gpointer handle;
char *entry;
+ printf (" label '%s' uuid '%s'\n", label, uuid);
+
/* check if /etc/fstab mentions this device... (with symlinks etc) */
if (! fstab_open (&handle)) {
printf ("cannot open /etc/fstab\n");
@@ -308,6 +310,23 @@
while ((entry = fstab_next (handle)) != NULL) {
char *resolved;
+#ifdef DEBUG
+ printf ("Looking at /etc/fstab entry '%s'\n", entry);
+#endif
+ if (label != NULL && g_str_has_prefix (entry, "LABEL=")) {
+ if (strcmp (entry + 6, label) == 0) {
+ printf ("%s found in /etc/fstab. Not mounting.\n", entry);
+ permission_denied_etc_fstab (device);
+ }
+ }
+
+ if (uuid != NULL && g_str_has_prefix (entry, "UUID=")) {
+ if (strcmp (entry + 5, uuid) == 0) {
+ printf ("%s found in /etc/fstab. Not mounting.\n", entry);
+ permission_denied_etc_fstab (device);
+ }
+ }
+
resolved = resolve_symlink (entry);
#ifdef DEBUG
printf ("/etc/fstab: device %s -> %s \n", entry, resolved);
@@ -451,6 +470,8 @@
uid_t calling_uid;
gid_t calling_gid;
#endif
+ const char *label;
+ const char *uuid;
#ifdef DEBUG
printf ("device = %s\n", device);
@@ -474,7 +495,15 @@
}
}
- bailout_if_in_fstab (device);
+ if (volume != NULL) {
+ label = libhal_volume_get_label (volume);
+ uuid = libhal_volume_get_uuid (volume);
+ } else {
+ label = NULL;
+ uuid = NULL;
+ }
+
+ bailout_if_in_fstab (device, label, uuid);
/* TODO: sanity check that what hal exports is correct (cf. Martin Pitt's email) */
@@ -650,10 +679,12 @@
* (since these drives normally use vfat)
*/
if (volume != NULL) {
- /* don't consider uid= on vfat change-uid for the purpose of policy
- * (since vfat doesn't contain uid/gid bits)
+ /* don't consider uid= on vfat, iso9660, udf change-uid for the purpose of policy
+ * (since these doesn't contain uid/gid bits)
*/
- if (strcmp (libhal_volume_get_fstype (volume), "vfat") != 0) {
+ if (strcmp (libhal_volume_get_fstype (volume), "vfat") != 0 &&
+ strcmp (libhal_volume_get_fstype (volume), "iso9660") != 0 &&
+ strcmp (libhal_volume_get_fstype (volume), "udf") != 0) {
pol_change_uid = wants_to_change_uid;
}
}
Index: hal-system-storage-cleanup-mountpoints
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-cleanup-mountpoints,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- hal-system-storage-cleanup-mountpoints 17 May 2006 20:12:17 -0000 1.5
+++ hal-system-storage-cleanup-mountpoints 21 Jun 2006 00:44:03 -0000 1.6
@@ -6,8 +6,9 @@
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
- exec $0-$HALD_UNAME_S $@
+
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-storage-cleanup-mountpoints-$HALD_UNAME_S ]; then
+ exec ./$HALD_UNAME_S/hal-system-storage-cleanup-mountpoints-$HALD_UNAME_S $@
else
echo "org.freedesktop.Hal.Device.UnknownError" >&2
echo "No back-end for your operating system" >&2
More information about the hal-commit
mailing list