From 840e1c8de10161c888b3d09a56ab770bff71afd7 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 8 Jun 2010 20:43:27 +0200 Subject: Fixes GB#621001: don't allow whitespaces in UUIDs * Using MD5 of the mount name for the UUID of optical media * Using MD5 of the mount path for the UUID of GMounts without a corresponding GVolume --- src/libtracker-miner/tracker-storage.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libtracker-miner/tracker-storage.c b/src/libtracker-miner/tracker-storage.c index 18b8ad1..47c215d 100644 --- a/src/libtracker-miner/tracker-storage.c +++ b/src/libtracker-miner/tracker-storage.c @@ -464,7 +464,10 @@ mount_add (TrackerStorage *storage, is_multimedia ? "yes" : "no"); if (!is_multimedia) { - uuid = g_strdup (mount_name); + /* Get UUID as MD5 digest of the mount name */ + uuid = g_compute_checksum_for_string (G_CHECKSUM_MD5, + mount_name, + -1); is_optical = TRUE; is_removable = TRUE; g_debug (" Using UUID:'%s' for optical disc", uuid); @@ -489,7 +492,10 @@ mount_add (TrackerStorage *storage, uuid = g_mount_get_uuid (mount); if (!uuid) { if(mount_path) { - uuid = g_strdup (mount_path); + /* Get UUID as MD5 digest of the mount path */ + uuid = g_compute_checksum_for_string (G_CHECKSUM_MD5, + mount_path, + -1); g_debug (" No UUID, so using:'%s' for mount without volume", uuid); } else { -- cgit v1.2.1