From a70b042f0dcebb10689975c65a2c45b52b7a4437 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Wed, 4 Jun 2003 05:20:20 +0000 Subject: 2003-06-04 Havoc Pennington * 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. --- dbus/dbus-server-unix.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'dbus/dbus-server-unix.c') diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c index fe4dbaa4..036446af 100644 --- a/dbus/dbus-server-unix.c +++ b/dbus/dbus-server-unix.c @@ -268,11 +268,13 @@ _dbus_server_new_for_fd (int fd, * Creates a new server listening on the given Unix domain socket. * * @param path the path for the domain socket. + * @param abstract #TRUE to use abstract socket namespace * @param error location to store reason for failure. * @returns the new server, or #NULL on failure. */ DBusServer* _dbus_server_new_for_domain_socket (const char *path, + dbus_bool_t abstract, DBusError *error) { DBusServer *server; @@ -289,7 +291,10 @@ _dbus_server_new_for_domain_socket (const char *path, return NULL; } - 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); @@ -303,7 +308,7 @@ _dbus_server_new_for_domain_socket (const char *path, goto failed_0; } - listen_fd = _dbus_listen_unix_socket (path, error); + listen_fd = _dbus_listen_unix_socket (path, abstract, error); _dbus_fd_set_close_on_exec (listen_fd); if (listen_fd < 0) -- cgit