rpms/hal/devel hal-20080924-fix-replace_slash_in_end_of_udi.patch, NONE, 1.1 hal.spec, 1.161, 1.162

Richard Hughes rhughes at fedoraproject.org
Mon Oct 6 10:05:14 UTC 2008


Author: rhughes

Update of /cvs/pkgs/rpms/hal/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17575

Modified Files:
	hal.spec 
Added Files:
	hal-20080924-fix-replace_slash_in_end_of_udi.patch 
Log Message:
* Mon Oct 06 2008 Richard Hughes <rhughes at redhat.com> - 0.5.12-1.20081001git
- Add a patch from the mailing list to try and fix rh#442457


hal-20080924-fix-replace_slash_in_end_of_udi.patch:

--- NEW FILE hal-20080924-fix-replace_slash_in_end_of_udi.patch ---
diff --git a/hald/hald.c b/hald/hald.c
index a28d22e..051b33b 100644
--- a/hald/hald.c
+++ b/hald/hald.c
@@ -265,6 +265,8 @@ hald_compute_udi (gchar *dst, gsize dstsize, const gchar *format, ...)
 	hal_util_compute_udi_valist (hald_get_gdl (), dst, dstsize, format, args);
 	va_end (args);
 
+	hal_util_validate_udi (dst, dstsize);
+
 	if (hal_device_store_find (hald_get_gdl (), dst) == NULL &&
 	    hal_device_store_find (hald_get_tdl (), dst) == NULL)
 		goto out;
diff --git a/hald/util.c b/hald/util.c
index 51f5d8a..d291b5f 100644
--- a/hald/util.c
+++ b/hald/util.c
@@ -422,6 +422,26 @@ hal_util_compute_udi (HalDeviceStore *store, gchar *dst, gsize dstsize, const gc
 	va_end (args);
 }
 
+void
+hal_util_validate_udi (gchar *udi, gsize size) {
+
+	char end[size-29]; /* max size - "/org/freedesktop/Hal/devices/" */
+
+	if (sscanf (udi, "/org/freedesktop/Hal/devices/%s", end) == 1) {
+		if (strstr(end, "/") != NULL) {
+			HAL_DEBUG (("UDI end contains invalid char '/': '%s'", udi));
+
+			g_strcanon (end, "_"
+		    			 "abcdefghijklmnopqrstuvwxyz"
+		    			 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+		   	 		 "1234567890", '_');
+			g_snprintf (udi, size, "/org/freedesktop/Hal/devices/%s", end);
+
+			HAL_DEBUG (("Fixed UDI, replaced '/', new UDI: %s", udi));
+		}
+	} 
+}
+
 
 gboolean
 hal_util_path_ascend (gchar *path)
diff --git a/hald/util.h b/hald/util.h
index e1783e2..524268f 100644
--- a/hald/util.h
+++ b/hald/util.h
@@ -70,6 +70,8 @@ void hal_util_compute_udi_valist (HalDeviceStore *store, gchar *dst, gsize dstsi
 
 void hal_util_compute_udi (HalDeviceStore *store, gchar *dst, gsize dstsize, const gchar *format, ...);
 
+void hal_util_validate_udi (gchar *udi, gsize size);
+
 gboolean hal_util_path_ascend (gchar *path);
 
 void hal_util_grep_discard_existing_data (void);


Index: hal.spec
===================================================================
RCS file: /cvs/pkgs/rpms/hal/devel/hal.spec,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -r1.161 -r1.162
--- hal.spec	1 Oct 2008 15:06:40 -0000	1.161
+++ hal.spec	6 Oct 2008 10:04:43 -0000	1.162
@@ -28,12 +28,13 @@
 Name: hal
 Version: 0.5.12
 #Release: 5%{?dist}
-Release: 0.%{?alphatag}%{?dist}
+Release: 1.%{?alphatag}%{?dist}
 URL: http://www.freedesktop.org/Software/hal
 #Source0: http://hal.freedesktop.org/releases/%{name}-%{version}.tar.gz
 Source0: http://hal.freedesktop.org/releases/%{name}-%{version}-%{?alphatag}.tar.gz
 Patch1: hal-0.5.10-set-property-direct.patch
 Patch2: hal-change-priority.patch
+Patch3: hal-20080924-fix-replace_slash_in_end_of_udi.patch
 License: AFL or GPLv2
 Group: System Environment/Libraries
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
@@ -129,6 +130,7 @@
 %setup -q -n %{name}-%{version}
 %patch1 -p1 -b .direct
 %patch2 -p1 -b .priority
+%patch3 -p1 -b .udi-check
 
 %build
 autoreconf
@@ -273,6 +275,9 @@
 %{_datadir}/gtk-doc/html/libhal-storage/*
 
 %changelog
+* Mon Oct 06 2008 Richard Hughes <rhughes at redhat.com> - 0.5.12-1.20081001git
+- Add a patch from the mailing list to try and fix rh#442457
+
 * Wed Oct 01 2008 Richard Hughes <rhughes at redhat.com> - 0.5.12-0.20081001git
 - Update to git snapshot 20081001git
 




More information about the scm-commits mailing list