diff options
Diffstat (limited to 'source/l/hal/patches/fixup_udi_strings.diff')
-rw-r--r-- | source/l/hal/patches/fixup_udi_strings.diff | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/source/l/hal/patches/fixup_udi_strings.diff b/source/l/hal/patches/fixup_udi_strings.diff deleted file mode 100644 index 03549ec1..00000000 --- a/source/l/hal/patches/fixup_udi_strings.diff +++ /dev/null @@ -1,69 +0,0 @@ -Author: Danny Kukawka <danny.kukawka@web.de> -Date: Mon Oct 13 12:55:48 2008 +0200 - - fix udi: replace '/' in the last part of the udi - - Fixed udi handling. DBus forbids a '/' after the base path - (in case of HAL: '/org/freedesktop/Hal/devices/) of a DBus - path. Replace all not allowed chars in the last part of the - UDI (everything but _a-zA-Z0-9) with a '_'. - - This fixes also fd.o#16040. - -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 901e64f..81060e4 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]; -+ -+ 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 510c36c..5377e35 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); |