[tracker/mounts-without-volumes: 3/23] Fixes GB#621001: don't allow whitespaces in UUIDs



commit 644a07551ffff7e5cd133a2999c6e5195b8d8e4a
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Tue Jun 8 20:43:27 2010 +0200

    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 files 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 {



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