From 3136c70acc6adf53bef7c27dd08e28b4abf254c8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 4 Jan 2012 19:45:53 +0000 Subject: [PATCH 3/3] Clarify the meaning of the session bus default address Now that this is unquestionably only a listening address, we can be considerably clearer about it. Also, set the same default in cmake as in autotools, so that it works "out of the box" in cmake; and respect the --with-dbus-session-bus-default-address option everywhere, not just on Windows. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38201 --- README.cmake | 2 +- cmake/CMakeLists.txt | 4 ++-- configure.ac | 24 +++++++++++++++++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/README.cmake b/README.cmake index 0e92335..c4f0009 100644 --- a/README.cmake +++ b/README.cmake @@ -129,7 +129,7 @@ DBUS_HAVE_ATOMIC_INT:BOOL=OFF // install required system libraries DBUS_INSTALL_SYSTEM_LIBS:BOOL=OFF -// session bus default address +// session bus default listening address DBUS_SESSION_BUS_DEFAULT_ADDRESS:STRING=nonce-tcp: // system bus default address (only useful on Unix) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ce554fa..9bfff9e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -440,14 +440,14 @@ set (DBUS_USER ) set (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "unix:path=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket" CACHE STRING "system bus default address") if (WIN32) - set (DBUS_SESSION_BUS_DEFAULT_ADDRESS "nonce-tcp:" CACHE STRING "session bus default address") + set (DBUS_SESSION_BUS_DEFAULT_ADDRESS "nonce-tcp:" CACHE STRING "session bus default listening address") set (DBUS_SYSTEM_CONFIG_FILE "etc/dbus-1/system.conf") set (DBUS_SESSION_CONFIG_FILE "etc/dbus-1/session.conf") # bus-test expects a non empty string set (DBUS_USER "Administrator") else (WIN32) - set (DBUS_SESSION_BUS_DEFAULT_ADDRESS "unix:path=${DBUS_SESSION_SOCKET_DIR}" CACHE STRING "session bus default address") + set (DBUS_SESSION_BUS_DEFAULT_ADDRESS "unix:tmpdir=${DBUS_SESSION_SOCKET_DIR}" CACHE STRING "session bus default listening address") set (sysconfdir "") set (configdir ${sysconfdir}/dbus-1 ) set (DBUS_SYSTEM_CONFIG_FILE ${configdir}/system.conf) diff --git a/configure.ac b/configure.ac index 1bb03cd..254cc8b 100644 --- a/configure.ac +++ b/configure.ac @@ -149,7 +149,6 @@ AC_ARG_WITH(console-owner-file, AS_HELP_STRING([--with-console-owner-file=[filen AC_ARG_WITH(launchd-agent-dir, AS_HELP_STRING([--with-launchd-agent-dir=[dirname]],[directory to put the launchd agent (default: /Library/LaunchAgents)])) AC_ARG_WITH(dbus_user, AS_HELP_STRING([--with-dbus-user=],[User for running the DBUS daemon (messagebus)])) AC_ARG_WITH(dbus_daemondir, AS_HELP_STRING([--with-dbus-daemondir=[dirname]],[Directory for installing the DBUS daemon])) -AC_ARG_WITH(dbus_session_bus_default_address, AS_HELP_STRING([--with-dbus-session-bus-default-address=[nonce-tcp:/autolaunch:/tcp:host:port]],[Transport Type to be used (default: nonce-tcp:)]),with_dbus_session_bus_default_address=$withval,with_dbus_session_bus_default_address=nonce-tcp:) AC_ARG_ENABLE([embedded-tests], AS_HELP_STRING([--enable-embedded-tests], @@ -1589,14 +1588,33 @@ fi AC_DEFINE_UNQUOTED(DBUS_SESSION_SOCKET_DIR, "$DBUS_SESSION_SOCKET_DIR", [Where per-session bus puts its sockets]) AC_SUBST(DBUS_SESSION_SOCKET_DIR) -if test x$dbus_win = xyes; then +# This must be a listening address. It doesn't necessarily need to be an +# address you can connect to - it can be something vague like +# "nonce-tcp:". +# +# The default varies by platform. +AC_ARG_WITH([dbus_session_bus_default_address], + AS_HELP_STRING([--with-dbus-session-bus-default-address=[ADDRESS]], + [default address for a session bus to listen on (see configure.ac)]), + [with_dbus_session_bus_default_address=$withval], + [with_dbus_session_bus_default_address=]) + +if test "x$with_dbus_session_bus_default_address" != "x"; then + # the user specified something, trust them DBUS_SESSION_BUS_DEFAULT_ADDRESS="$with_dbus_session_bus_default_address" +elif test x$dbus_win = xyes; then + # The default on Windows is nonce-tcp: because Windows doesn't have + # Unix sockets + DBUS_SESSION_BUS_DEFAULT_ADDRESS="nonce-tcp:" elif test x$have_launchd = xyes; then + # Mac OS X default is to use launchd DBUS_SESSION_BUS_DEFAULT_ADDRESS="launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET" else + # The default on all other Unix platforms (notably Linux) + # is to create a randomly named socket in /tmp or similar DBUS_SESSION_BUS_DEFAULT_ADDRESS="unix:tmpdir=$DBUS_SESSION_SOCKET_DIR" fi -AC_SUBST(DBUS_SESSION_BUS_DEFAULT_ADDRESS) +AC_SUBST([DBUS_SESSION_BUS_DEFAULT_ADDRESS]) # darwin needs this to initialize the environment AC_CHECK_HEADERS(crt_externs.h) -- 1.7.8.2