hal/tools hal-system-storage-eject, 1.5,
1.6 hal-system-storage-mount, 1.20, 1.21
David Zeuthen
david at freedesktop.org
Thu Feb 9 19:41:57 PST 2006
Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv23886/tools
Modified Files:
hal-system-storage-eject hal-system-storage-mount
Log Message:
2006-02-09 David Zeuthen <davidz at redhat.com>
* tools/hal-system-storage-eject: only allow the user who mounted
the volume to unmount it (also allow uid 0). Use properties stored
on hal to figure out mount location.
* fdi/policy/10osvendor/20-storage-methods.fdi: Don't advertise flush
as a valid option as it is not upstream (SUSE guys: you need to patch
hal yourself until this is in an upstream kernel version that a hal
release can depend on)
Index: hal-system-storage-eject
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-eject,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- hal-system-storage-eject 18 Jan 2006 04:56:54 -0000 1.5
+++ hal-system-storage-eject 10 Feb 2006 03:41:54 -0000 1.6
@@ -13,6 +13,16 @@
exit 1
fi
+if [ "$HAL_METHOD_INVOKED_BY_UID" != "0" ]; then
+ if [ "$HAL_PROP_INFO_HAL_MOUNT_CREATED_MOUNT_POINT" != "" ]; then
+ if [ "$HAL_METHOD_INVOKED_BY_UID" != "$HAL_PROP_INFO_HAL_MOUNT_MOUNTED_BY_UID" ]; then
+ echo "org.freedesktop.Hal.Device.Volume.PermissionDenied" >&2
+ echo "Volume mounted by uid $HAL_PROP_INFO_HAL_MOUNT_MOUNTED_BY_UID cannot be ejected by uid $HAL_METHOD_INVOKED_BY_UID." >&2
+ exit 1
+ fi
+ fi
+fi
+
# read parameters
# "<option1>\t<option2>\n"
# Only allow ^a-zA-Z0-9_= in the string because otherwise someone may
@@ -35,10 +45,12 @@
exit 1
fi
-# remove directory only if HAL has created it
-if [ -e $HAL_PROP_VOLUME_MOUNT_POINT/.created-by-hal ]; then
- rm -f $HAL_PROP_VOLUME_MOUNT_POINT/.created-by-hal
- rmdir --ignore-fail-on-non-empty "$HAL_PROP_VOLUME_MOUNT_POINT"
+if [ "$HAL_PROP_INFO_HAL_MOUNT_CREATED_MOUNT_POINT" != "" ]; then
+ # remove directory only if HAL has created it
+ if [ -e $HAL_PROP_INFO_HAL_MOUNT_CREATED_MOUNT_POINT/.created-by-hal ]; then
+ rm -f $HAL_PROP_INFO_HAL_MOUNT_CREATED_MOUNT_POINT/.created-by-hal
+ rmdir --ignore-fail-on-non-empty "$HAL_PROP_INFO_HAL_MOUNT_CREATED_MOUNT_POINT"
+ fi
fi
exit 0
Index: hal-system-storage-mount
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-mount,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- hal-system-storage-mount 10 Feb 2006 02:49:34 -0000 1.20
+++ hal-system-storage-mount 10 Feb 2006 03:41:54 -0000 1.21
@@ -134,7 +134,7 @@
done
fi
-echo "options = '$MOUNTOPTIONS'"
+# echo "options = '$MOUNTOPTIONS'"
# append number to mountpoint if it already exists
if [ -e "$MOUNT_ROOT/$MOUNTPOINT" ]; then
More information about the hal-commit
mailing list