[Xfce4-commits] <exo:jannis/validate-hal-udis> HAL UDIs are valid only with the /org/freedesktop/Hal/device/ prefix.
Jannis Pohlmann
noreply at xfce.org
Mon Jan 11 13:00:03 CET 2010
Updating branch refs/heads/jannis/validate-hal-udis
to 4df75b6ff78d259635a2f084ef63741157dbd429 (commit)
from 320efc6965c654378d66fbe9313755d45b35bc8f (commit)
commit 4df75b6ff78d259635a2f084ef63741157dbd429
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Mon Jan 11 12:57:24 2010 +0100
HAL UDIs are valid only with the /org/freedesktop/Hal/device/ prefix.
exo-hal/exo-hal.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/exo-hal/exo-hal.c b/exo-hal/exo-hal.c
index a72d9f3..aa77519 100644
--- a/exo-hal/exo-hal.c
+++ b/exo-hal/exo-hal.c
@@ -305,6 +305,7 @@ exo_hal_udi_validate (const gchar *udi,
gssize len,
gchar **end)
{
+ const gchar *fixed_prefix = "/org/freedesktop/Hal/devices/";
const gchar *last_slash;
const gchar *e;
const gchar *s;
@@ -358,6 +359,17 @@ exo_hal_udi_validate (const gchar *udi,
return FALSE;
}
+ /* check whether the UDI starts with /org/freedesktop/Hal/devices */
+ for (s = udi, e = fixed_prefix; s != NULL && *s != '\0' && e != NULL && *e != '\0'; ++s, ++e)
+ {
+ if (*s != *e)
+ {
+ if (G_UNLIKELY (end != NULL))
+ *end = (gchar *) s;
+ return FALSE;
+ }
+ }
+
return TRUE;
}
More information about the Xfce4-commits
mailing list