summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-server-unix.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2005-02-11 03:37:03 +0000
committerHavoc Pennington <hp@redhat.com>2005-02-11 03:37:03 +0000
commitaa4f823781185fb18187714798795d7e4b0c9b65 (patch)
treee7f96d71925b867b85975f250616ba756c83ed6c /dbus/dbus-server-unix.c
parent71f3b461b371d6bf7c7bc4e92578420b78d5c0d8 (diff)
2005-02-10 Havoc Pennington <hp@redhat.com>
* test/glib/test-dbus-glib.c (main): fix so this test doesn't fail (call dbus_g_proxy_add_signal) * dbus/dbus-server-unix.c (_dbus_server_new_for_tcp_socket): escape the hostname (_dbus_server_new_for_domain_socket): escape the path * dbus/dbus-address.c (dbus_address_escape_value): new (dbus_address_unescape_value): new (dbus_parse_address): unescape values * dbus/dbus-string.c (_dbus_string_append_byte_as_hex): new function * doc/dbus-specification.xml: explain how to escape values in addresses
Diffstat (limited to 'dbus/dbus-server-unix.c')
-rw-r--r--dbus/dbus-server-unix.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c
index 12f4ca6a..f576b427 100644
--- a/dbus/dbus-server-unix.c
+++ b/dbus/dbus-server-unix.c
@@ -279,6 +279,7 @@ _dbus_server_new_for_domain_socket (const char *path,
int listen_fd;
DBusString address;
char *path_copy;
+ DBusString path_str;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
@@ -288,11 +289,12 @@ _dbus_server_new_for_domain_socket (const char *path,
return NULL;
}
+ _dbus_string_init_const (&path_str, path);
if ((abstract &&
!_dbus_string_append (&address, "unix:abstract=")) ||
(!abstract &&
!_dbus_string_append (&address, "unix:path=")) ||
- !_dbus_string_append (&address, path))
+ !_dbus_address_append_escaped (&address, &path_str))
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
goto failed_0;
@@ -355,6 +357,7 @@ _dbus_server_new_for_tcp_socket (const char *host,
DBusServer *server;
int listen_fd;
DBusString address;
+ DBusString host_str;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
@@ -366,9 +369,10 @@ _dbus_server_new_for_tcp_socket (const char *host,
if (host == NULL)
host = "localhost";
-
+
+ _dbus_string_init_const (&host_str, host);
if (!_dbus_string_append (&address, "tcp:host=") ||
- !_dbus_string_append (&address, host) ||
+ !_dbus_address_append_escaped (&address, &host_str) ||
!_dbus_string_append (&address, ",port=") ||
!_dbus_string_append_int (&address, port))
{