diff options
author | Havoc Pennington <hp@redhat.com> | 2003-06-04 05:20:20 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-06-04 05:20:20 +0000 |
commit | a70b042f0dcebb10689975c65a2c45b52b7a4437 (patch) | |
tree | 46a45a6933e1f9fbf6ac30cc819e96f60536342f /dbus/dbus-transport-unix.c | |
parent | 0e024fc53a5effadedd56427ffe261c417e45222 (diff) |
2003-06-04 Havoc Pennington <hp@pobox.com>
* dbus/dbus-server.c (dbus_server_listen): allow abstract sockets
using unix:abstract=/foo, and when listening in a tmpdir
i.e. unix:tmpdir=/tmp, always use abstract sockets if we can.
* dbus/dbus-transport.c (_dbus_transport_open): support
unix:abstract=/foo
* dbus/dbus-server-unix.c (_dbus_server_new_for_domain_socket):
support abstract sockets
* dbus/dbus-transport-unix.c
(_dbus_transport_new_for_domain_socket): support abstract sockets
* dbus/dbus-sysdeps.c (_dbus_connect_unix_socket): add "abstract"
toggle as an argument, implement abstract namespace support
(_dbus_listen_unix_socket): ditto
* configure.in: add --enable-abstract-sockets and implement
a configure check for autodetection of the right value.
Diffstat (limited to 'dbus/dbus-transport-unix.c')
-rw-r--r-- | dbus/dbus-transport-unix.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/dbus/dbus-transport-unix.c b/dbus/dbus-transport-unix.c index 5df1c461..e5e446c2 100644 --- a/dbus/dbus-transport-unix.c +++ b/dbus/dbus-transport-unix.c @@ -1080,12 +1080,17 @@ _dbus_transport_new_for_fd (int fd, * Creates a new transport for the given Unix domain socket * path. This creates a client-side of a transport. * + * @todo once we add a way to escape paths in a dbus + * address, this function needs to do escaping. + * * @param path the path to the domain socket. + * @param abstract #TRUE to use abstract socket namespace * @param error address where an error can be returned. * @returns a new transport, or #NULL on failure. */ DBusTransport* _dbus_transport_new_for_domain_socket (const char *path, + dbus_bool_t abstract, DBusError *error) { int fd; @@ -1101,15 +1106,18 @@ _dbus_transport_new_for_domain_socket (const char *path, } fd = -1; - - if (!_dbus_string_append (&address, "unix:path=") || + + if ((abstract && + !_dbus_string_append (&address, "unix:abstract=")) || + (!abstract && + !_dbus_string_append (&address, "unix:path=")) || !_dbus_string_append (&address, path)) { dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); goto failed_0; } - fd = _dbus_connect_unix_socket (path, error); + fd = _dbus_connect_unix_socket (path, abstract, error); if (fd < 0) { _DBUS_ASSERT_ERROR_IS_SET (error); |