summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-server.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-06-04 05:20:20 +0000
committerHavoc Pennington <hp@redhat.com>2003-06-04 05:20:20 +0000
commita70b042f0dcebb10689975c65a2c45b52b7a4437 (patch)
tree46a45a6933e1f9fbf6ac30cc819e96f60536342f /dbus/dbus-server.c
parent0e024fc53a5effadedd56427ffe261c417e45222 (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-server.c')
-rw-r--r--dbus/dbus-server.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/dbus/dbus-server.c b/dbus/dbus-server.c
index e62c0284..4007d7a5 100644
--- a/dbus/dbus-server.c
+++ b/dbus/dbus-server.c
@@ -295,17 +295,20 @@ dbus_server_listen (const char *address,
{
const char *path = dbus_address_entry_get_value (entries[i], "path");
const char *tmpdir = dbus_address_entry_get_value (entries[i], "tmpdir");
+ const char *abstract = dbus_address_entry_get_value (entries[i], "abstract");
- if (path == NULL && tmpdir == NULL)
+ if (path == NULL && tmpdir == NULL && abstract == NULL)
{
address_problem_type = "unix";
- address_problem_field = "path or tmpdir";
+ address_problem_field = "path or tmpdir or abstract";
goto bad_address;
}
- if (path && tmpdir)
+ if ((path && tmpdir) ||
+ (path && abstract) ||
+ (tmpdir && abstract))
{
- address_problem_other = "cannot specify both \"path\" and \"tmpdir\" at the same time";
+ address_problem_other = "cannot specify two of \"path\" and \"tmpdir\" and \"abstract\" at the same time";
goto bad_address;
}
@@ -339,14 +342,22 @@ dbus_server_listen (const char *address,
goto out;
}
- /* FIXME - we will unconditionally unlink() the path.
- * unlink() does not follow symlinks, but would like
- * independent confirmation this is safe enough. See
- * also _dbus_listen_unix_socket() and comments therein.
+ /* FIXME - we will unconditionally unlink() the path if
+ * we don't support abstract namespace. unlink() does
+ * not follow symlinks, but would like independent
+ * confirmation this is safe enough. See also
+ * _dbus_listen_unix_socket() and comments therein.
*/
+
+ /* Always use abstract namespace if possible with tmpdir */
server =
_dbus_server_new_for_domain_socket (_dbus_string_get_const_data (&full_path),
+#ifdef HAVE_ABSTRACT_SOCKETS
+ TRUE,
+#else
+ FALSE,
+#endif
error);
_dbus_string_free (&full_path);
@@ -354,7 +365,10 @@ dbus_server_listen (const char *address,
}
else
{
- server = _dbus_server_new_for_domain_socket (path, error);
+ if (path)
+ server = _dbus_server_new_for_domain_socket (path, FALSE, error);
+ else
+ server = _dbus_server_new_for_domain_socket (abstract, TRUE, error);
}
}
else if (strcmp (method, "tcp") == 0)