hal/tools hal-system-storage-mount,1.17,1.18
Kay Sievers
kay at freedesktop.org
Thu Jan 26 07:15:09 PST 2006
Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv31259/tools
Modified Files:
hal-system-storage-mount
Log Message:
2006-01-26 Kay Sievers <kay.sievers at vrfy.org>
* tools/hal-system-storage-mount: Don't allow mountpoints to start
with a "." like "/media/." Thanks Coolo!
Index: hal-system-storage-mount
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-mount,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- hal-system-storage-mount 26 Jan 2006 14:44:56 -0000 1.17
+++ hal-system-storage-mount 26 Jan 2006 15:15:07 -0000 1.18
@@ -33,20 +33,24 @@
# "MyDisk\n"
# "fuse\n"
# "ro\tsync\n"
-# Only allow ^a-zA-Z0-9_= in the string because otherwise someone may
+#
+# only allow ^a-zA-Z0-9_= in the string because otherwise someone may
# pass e.g. umask=0600,suid,dev or umask=`/bin/evil`
read GIVEN_MOUNTPOINT
-GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^a-zA-Z0-9_.+-]/@}
+GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^a-zA-Z0-9_:.+-]/@}
read GIVEN_MOUNTTYPE
GIVEN_MOUNTTYPE=${GIVEN_MOUNTTYPE//[^a-zA-Z0-9_=]/_}
read GIVEN_MOUNTOPTIONS
GIVEN_MOUNTOPTIONS=${GIVEN_MOUNTOPTIONS//[^a-zA-Z0-9_=[:space:]]/_}
-# if no mountpoint, get mountpoint from label
+# if no mountpoint is requested, get the mountpoint from the filesystem
+# label if it does not contain invalid chars or starts with a "."
if [ "$GIVEN_MOUNTPOINT" == "" ]; then
case "$HAL_PROP_VOLUME_LABEL" in
- *[!A-Za-z0-9_\-\+:]*)
+ *[!A-Za-z0-9_:.+-]*)
+ ;;
+ .*)
;;
*)
GIVEN_MOUNTPOINT="$HAL_PROP_VOLUME_LABEL"
@@ -58,9 +62,10 @@
GIVEN_MOUNTPOINT="disk"
fi
-# we've replaced invalid characters in requested mountpoint with '@'
+# last check, we've replaced invalid characters in requested mountpoint
+# with '@' and don't allow a specified mountpoint starting with "."
case "$GIVEN_MOUNTPOINT" in
- *@*)
+ .*|*@*)
echo "org.freedesktop.Hal.Device.Volume.InvalidMountpoint" >&2
echo "The mountpoint is invalid." >&2
exit 1
More information about the hal-commit
mailing list