[PATCH] mount: use encoded labels for volume_id

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

 



Hi,

since udev-112 exports now the label encoding function,
here is a proposed patch.
This fixes the problem of user mounts when filsystems
with unsafe characters are given via LABEL= in fstab.

Matthias

mount: use encoded labels

Use the volume_id_encode_string function for labels, which
has been introduced in udev-112.

Signed-Off-By: Matthias Koenig <mkoenig@xxxxxxx>

Index: util-linux-ng-2.12r+git20070530/mount/fsprobe_volumeid.c
===================================================================
--- util-linux-ng-2.12r+git20070530.orig/mount/fsprobe_volumeid.c
+++ util-linux-ng-2.12r+git20070530/mount/fsprobe_volumeid.c
@@ -113,11 +113,17 @@ const char *
 fsprobe_get_devname_by_label(const char *label)
 {
 	char dev[PATH_MAX];
+	char *enc_label;
+	size_t enc_size;
 
 	if (!label)
 		return NULL;
 
-	snprintf(dev, sizeof(dev), PATH_DEV_BYLABEL "/%s", label);
+	enc_size = 4*strlen(label);
+	enc_label = xmalloc(enc_size);
+	volume_id_encode_string(label, enc_label, enc_size); 
+	snprintf(dev, sizeof(dev), PATH_DEV_BYLABEL "/%s", enc_label);
+	free(enc_label);
 	return canonicalize(dev);
 }
 

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux