aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-04-21 23:06:05 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-04-21 23:06:05 +0800
commit4c140ad31a3b5a6b919f6acd8b6c79f9a8d3ab5f (patch)
tree94c99c9e1ebb97d47ff5a4abc37ba8b91f657e25
parent27ba4ebcae6321cb8d57c90f25351376f50cd99c (diff)
parent3ba482ccc034647d8e4bde47f92e3a86720150a3 (diff)
downloadgsoc2013-empathy-4c140ad31a3b5a6b919f6acd8b6c79f9a8d3ab5f.tar
gsoc2013-empathy-4c140ad31a3b5a6b919f6acd8b6c79f9a8d3ab5f.tar.gz
gsoc2013-empathy-4c140ad31a3b5a6b919f6acd8b6c79f9a8d3ab5f.tar.bz2
gsoc2013-empathy-4c140ad31a3b5a6b919f6acd8b6c79f9a8d3ab5f.tar.lz
gsoc2013-empathy-4c140ad31a3b5a6b919f6acd8b6c79f9a8d3ab5f.tar.xz
gsoc2013-empathy-4c140ad31a3b5a6b919f6acd8b6c79f9a8d3ab5f.tar.zst
gsoc2013-empathy-4c140ad31a3b5a6b919f6acd8b6c79f9a8d3ab5f.zip
Merge branch 'tube-bus-name'
-rw-r--r--libempathy/empathy-tube-handler.c23
-rw-r--r--src/empathy-tube-dispatch.c11
2 files changed, 33 insertions, 1 deletions
diff --git a/libempathy/empathy-tube-handler.c b/libempathy/empathy-tube-handler.c
index 4fb82177d..18cda18b3 100644
--- a/libempathy/empathy-tube-handler.c
+++ b/libempathy/empathy-tube-handler.c
@@ -185,12 +185,31 @@ OUT:
return thandler;
}
+static gchar *
+sanitize_service_name (const gchar *str)
+{
+ guint i;
+ gchar *result;
+
+ g_assert (str != NULL);
+ result = g_strdup (str);
+
+ for (i = 0; result[i] != '\0'; i++)
+ {
+ if (!g_ascii_isalnum (result[i]))
+ result[i] = '_';
+ }
+
+ return result;
+}
+
gchar *
empathy_tube_handler_build_bus_name (TpTubeType type,
const gchar *service)
{
gchar *str = NULL;
const gchar *prefix = NULL;
+ gchar *service_escaped;
g_return_val_if_fail (type < NUM_TP_TUBE_TYPES, NULL);
g_return_val_if_fail (service != NULL, NULL);
@@ -202,7 +221,9 @@ empathy_tube_handler_build_bus_name (TpTubeType type,
else
g_return_val_if_reached (NULL);
- str = g_strconcat (prefix, service, NULL);
+ service_escaped = sanitize_service_name (service);
+ str = g_strconcat (prefix, service_escaped, NULL);
+ g_free (service_escaped);
return str;
}
diff --git a/src/empathy-tube-dispatch.c b/src/empathy-tube-dispatch.c
index b1e7bce6d..63b31b2b6 100644
--- a/src/empathy-tube-dispatch.c
+++ b/src/empathy-tube-dispatch.c
@@ -167,9 +167,20 @@ empathy_tube_dispatch_constructed (GObject *object)
}
else if (!tp_strdiff (channel_type, EMP_IFACE_CHANNEL_TYPE_DBUS_TUBE))
{
+ GError *error = NULL;
+
type = TP_TUBE_TYPE_DBUS;
service = tp_asv_get_string (properties,
EMP_IFACE_CHANNEL_TYPE_DBUS_TUBE ".ServiceName");
+
+ if (!tp_dbus_check_valid_bus_name (service, TP_DBUS_NAME_TYPE_WELL_KNOWN,
+ &error))
+ {
+ DEBUG ("Can't dispatch tube; invalid ServiceName %s: %s", service,
+ error->message);
+ g_error_free (error);
+ goto failed;
+ }
}
else
{