diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-08-13 20:02:11 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-08-13 20:02:11 +0100 |
commit | 1dd0ff6d5bc95516d26bd1dff6dd97599ac60e2e (patch) | |
tree | f41cc515f26fc57929a942b86fe028b6cbfc4bc3 | |
parent | e33c318c1399e58c8e1c0934282d2d47d9539b9b (diff) | |
parent | b5d36dc27d1905d4d46ad7f0097f0ea0e0776adb (diff) | |
download | dbus-1dd0ff6d5bc95516d26bd1dff6dd97599ac60e2e.tar.gz |
Merge branch 'dbus-1.6'
-rw-r--r-- | README.cmake | 13 | ||||
-rw-r--r-- | bus/session.conf.in | 2 | ||||
-rw-r--r-- | cmake/CMakeLists.txt | 20 | ||||
-rw-r--r-- | cmake/config.h.cmake | 2 | ||||
-rw-r--r-- | cmake/dbus-env.bat.cmake | 4 | ||||
-rw-r--r-- | configure.ac | 77 | ||||
-rw-r--r-- | dbus/dbus-bus.c | 8 | ||||
-rw-r--r-- | dbus/dbus-internals.h | 4 |
8 files changed, 99 insertions, 31 deletions
diff --git a/README.cmake b/README.cmake index 5feaf551..0c30ba66 100644 --- a/README.cmake +++ b/README.cmake @@ -80,7 +80,7 @@ Configuration flags When using the cmake build system the dbus-specific configuration flags that can be given to the cmake program are these (use -D<key>=<value> on command line). The listed values -are the defaults. +are the defaults (in a typical build - some are platform-specific). // Choose the type of build, options are: None(CMAKE_CXX_FLAGS or // CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. @@ -129,11 +129,14 @@ DBUS_HAVE_ATOMIC_INT:BOOL=OFF // install required system libraries DBUS_INSTALL_SYSTEM_LIBS:BOOL=OFF -// session bus default address -DBUS_SESSION_BUS_DEFAULT_ADDRESS:STRING=nonce-tcp: +// session bus default listening address +DBUS_SESSION_BUS_LISTEN_ADDRESS:STRING=autolaunch: -// system bus default address -DBUS_SYSTEM_BUS_DEFAULT_ADDRESS:STRING=nonce-tcp: +// session bus fallback address for clients +DBUS_SESSION_BUS_CONNECT_ADDRESS:STRING=autolaunch: + +// system bus default address (only useful on Unix) +DBUS_SYSTEM_BUS_DEFAULT_ADDRESS:STRING=unix:path=/var/run/dbus/system_bus_socket // Use atomic integer implementation for 486 DBUS_USE_ATOMIC_INT_486:BOOL=OFF diff --git a/bus/session.conf.in b/bus/session.conf.in index e121ff93..716b5e79 100644 --- a/bus/session.conf.in +++ b/bus/session.conf.in @@ -12,7 +12,7 @@ the behavior of child processes. --> <keep_umask/> - <listen>@DBUS_SESSION_BUS_DEFAULT_ADDRESS@</listen> + <listen>@DBUS_SESSION_BUS_LISTEN_ADDRESS@</listen> <standard_session_servicedirs /> diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 000acda2..52a48fdc 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -431,18 +431,27 @@ endif (WIN32) set (DBUS_USER ) +# This won't work on Windows. It's not meant to - the system bus is +# meaningless on Windows anyway. +# +# This has to be suitable for hard-coding in client libraries as well as +# in the dbus-daemon's configuration, so it has to be valid to listen on +# and also to connect to. If this ever changes, it'll need to be split into +# two variables, one for the listening address and one for the connecting +# address. +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_SYSTEM_BUS_DEFAULT_ADDRESS "nonce-tcp:" CACHE STRING "system bus default address") - set (DBUS_SESSION_BUS_DEFAULT_ADDRESS "nonce-tcp:" CACHE STRING "session bus default address") + set (DBUS_SESSION_BUS_LISTEN_ADDRESS "autolaunch:" CACHE STRING "session bus default listening address") + set (DBUS_SESSION_BUS_CONNECT_ADDRESS "autolaunch:" CACHE STRING "session bus fallback address for clients") 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_SYSTEM_BUS_DEFAULT_ADDRESS "unix:tmpdir=" CACHE STRING "system bus default address") - set (DBUS_SESSION_BUS_DEFAULT_ADDRESS "unix:path=${DBUS_SESSION_SOCKET_DIR}" CACHE STRING "session bus default address") + set (DBUS_SESSION_BUS_LISTEN_ADDRESS "unix:tmpdir=${DBUS_SESSION_SOCKET_DIR}" CACHE STRING "session bus default listening address") + set (DBUS_SESSION_BUS_CONNECT_ADDRESS "autolaunch:" CACHE STRING "session bus fallback address for clients") set (sysconfdir "") set (configdir ${sysconfdir}/dbus-1 ) set (DBUS_SYSTEM_CONFIG_FILE ${configdir}/system.conf) @@ -562,7 +571,8 @@ message(" Using XML parser: ${XML_LIB} " message(" Daemon executable name: ${DBUS_DAEMON_NAME}") if (WIN32) message(" System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS} ") -message(" Session bus address: ${DBUS_SESSION_BUS_DEFAULT_ADDRESS} ") +message(" Session bus listens on: ${DBUS_SESSION_BUS_LISTEN_ADDRESS} ") +message(" Session clients connect to: ${DBUS_SESSION_BUS_CONNECT_ADDRESS} ") else (WIN32) #message(" Init scripts style: ${with_init_scripts} ") #message(" Abstract socket names: ${have_abstract_sockets} ") diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 6221c190..76ccb866 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -15,8 +15,8 @@ #cmakedefine DBUS_SESSION_CONFIG_FILE "@DBUS_SESSION_CONFIG_FILE@" #cmakedefine DBUS_DAEMON_NAME "@DBUS_DAEMON_NAME@" #cmakedefine DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "@DBUS_SYSTEM_BUS_DEFAULT_ADDRESS@" +#cmakedefine DBUS_SESSION_BUS_CONNECT_ADDRESS "@DBUS_SESSION_BUS_CONNECT_ADDRESS@" #cmakedefine DBUS_MACHINE_UUID_FILE "@DBUS_MACHINE_UUID_FILE@" -#cmakedefine DBUS_SESSION_BUS_DEFAULT_ADDRESS "@DBUS_SESSION_BUS_DEFAULT_ADDRESS@" #cmakedefine DBUS_DAEMONDIR "@DBUS_DAEMONDIR@" #cmakedefine PACKAGE "@PACKAGE@" /* Version number of package */ diff --git a/cmake/dbus-env.bat.cmake b/cmake/dbus-env.bat.cmake index 85f70051..d859ce03 100644 --- a/cmake/dbus-env.bat.cmake +++ b/cmake/dbus-env.bat.cmake @@ -2,7 +2,7 @@ @echo off :: session bus address -set DBUS_SESSION_BUS_ADDRESS=@DBUS_SESSION_BUS_DEFAULT_ADDRESS@ +set DBUS_SESSION_BUS_ADDRESS=@DBUS_SESSION_BUS_CONNECT_ADDRESS@ :: system bus address -set DBUS_SYSTEM_BUS_DEFAULT_ADDRESS=@DBUS_SYSTEM_BUS_DEFAULT_ADDRESS@
\ No newline at end of file +set DBUS_SYSTEM_BUS_DEFAULT_ADDRESS=@DBUS_SYSTEM_BUS_DEFAULT_ADDRESS@ diff --git a/configure.ac b/configure.ac index be498022..fee9db6b 100644 --- a/configure.ac +++ b/configure.ac @@ -169,7 +169,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>],[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], @@ -1521,8 +1520,17 @@ fi AC_SUBST(DBUS_SYSTEM_SOCKET) AC_DEFINE_UNQUOTED(DBUS_SYSTEM_SOCKET,"$DBUS_SYSTEM_SOCKET",[The name of the socket the system bus listens on by default]) -## system bus only listens on local domain sockets, and never -## on an abstract socket (so only root can create the socket) +## System bus only listens on local domain sockets, and never +## on an abstract socket (so only root can create the socket). +## +## This won't work on Windows. It's not meant to - the system bus is +## meaningless on Windows anyway. +## +## This has to be suitable for hard-coding in client libraries as well as +## in the dbus-daemon's configuration, so it has to be valid to listen on +## and also to connect to. If this ever changes, it'll need to be split into +## two variables, one for the listening address and one for the connecting +## address. DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$DBUS_SYSTEM_SOCKET" AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS) AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS, "$DBUS_SYSTEM_BUS_DEFAULT_ADDRESS",[The default D-Bus address of the system bus]) @@ -1666,14 +1674,64 @@ 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 - DBUS_SESSION_BUS_DEFAULT_ADDRESS="$with_dbus_session_bus_default_address" +# 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_listen_address], + AS_HELP_STRING([--with-dbus-session-bus-listen-address=[ADDRESS]], + [default address for a session bus to listen on (see configure.ac)]), + [with_dbus_session_bus_listen_address=$withval], + [with_dbus_session_bus_listen_address=]) + +if test "x$with_dbus_session_bus_listen_address" != "x"; then + # the user specified something, trust them + DBUS_SESSION_BUS_LISTEN_ADDRESS="$with_dbus_session_bus_listen_address" +elif test x$dbus_win = xyes; then + # On Windows, you can (and should) listen on autolaunch addresses, + # because autolaunching is different. + # See https://bugs.freedesktop.org/show_bug.cgi?id=38201 + DBUS_SESSION_BUS_LISTEN_ADDRESS="autolaunch:" elif test x$have_launchd = xyes; then - DBUS_SESSION_BUS_DEFAULT_ADDRESS="launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET" + # Mac OS X default is to use launchd + DBUS_SESSION_BUS_LISTEN_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_LISTEN_ADDRESS="unix:tmpdir=$DBUS_SESSION_SOCKET_DIR" +fi +AC_SUBST([DBUS_SESSION_BUS_LISTEN_ADDRESS]) + +# This must be an address you can connect to. It doesn't necessarily +# need to be an address you can listen on - it can be "autolaunch:", +# even on Unix. +# +# The default varies by platform. +AC_ARG_WITH([dbus_session_bus_connect_address], + AS_HELP_STRING([--with-dbus-session-bus-connect-address=[ADDRESS]], + [fallback address for a session bus client to connect to (see configure.ac)]), + [with_dbus_session_bus_connect_address=$withval], + [with_dbus_session_bus_connect_address=]) + +if test "x$with_dbus_session_bus_connect_address" != "x"; then + # the user specified something, trust them + DBUS_SESSION_BUS_CONNECT_ADDRESS="$with_dbus_session_bus_connect_address" +elif test x$dbus_win = xyes; then + # Windows autolaunching is a bit different; leaving it in its own + # branch of the conditional because the default might conceivably + # change (see #38201) + DBUS_SESSION_BUS_CONNECT_ADDRESS="autolaunch:" else - DBUS_SESSION_BUS_DEFAULT_ADDRESS="unix:tmpdir=$DBUS_SESSION_SOCKET_DIR" + # The default on all other Unix platforms (notably Linux) + # is to use auto-launching - this works a bit differently on Mac OS X + # but comes out basically the same in the end + DBUS_SESSION_BUS_CONNECT_ADDRESS="autolaunch:" fi -AC_SUBST(DBUS_SESSION_BUS_DEFAULT_ADDRESS) +AC_SUBST([DBUS_SESSION_BUS_CONNECT_ADDRESS]) +AC_DEFINE_UNQUOTED([DBUS_SESSION_BUS_CONNECT_ADDRESS], + ["$DBUS_SESSION_BUS_CONNECT_ADDRESS"], + [Fallback address for session bus clients]) # darwin needs this to initialize the environment AC_CHECK_HEADERS(crt_externs.h) @@ -1789,7 +1847,8 @@ echo " System bus socket: ${DBUS_SYSTEM_SOCKET} System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS} System bus PID file: ${DBUS_SYSTEM_PID_FILE} - Session bus address: ${DBUS_SESSION_BUS_DEFAULT_ADDRESS} + Session bus listens on: ${DBUS_SESSION_BUS_LISTEN_ADDRESS} + Session clients connect to: ${DBUS_SESSION_BUS_CONNECT_ADDRESS} Console auth dir: ${DBUS_CONSOLE_AUTH_DIR} Console owner file: ${have_console_owner_file} Console owner file path: ${DBUS_CONSOLE_OWNER_FILE} diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c index fadc3a8b..6f81c74a 100644 --- a/dbus/dbus-bus.c +++ b/dbus/dbus-bus.c @@ -192,12 +192,12 @@ init_session_address (void) if (!retval) return FALSE; - /* The DBUS_SESSION_BUS_DEFAULT_ADDRESS should have really been named - * DBUS_SESSION_BUS_FALLBACK_ADDRESS. - */ + /* We have a hard-coded (but compile-time-configurable) fallback address for + * the session bus. */ if (bus_connection_addresses[DBUS_BUS_SESSION] == NULL) bus_connection_addresses[DBUS_BUS_SESSION] = - _dbus_strdup (DBUS_SESSION_BUS_DEFAULT_ADDRESS); + _dbus_strdup (DBUS_SESSION_BUS_CONNECT_ADDRESS); + if (bus_connection_addresses[DBUS_BUS_SESSION] == NULL) return FALSE; diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index 8036a2ba..80376ad5 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -35,10 +35,6 @@ DBUS_BEGIN_DECLS -#ifndef DBUS_SESSION_BUS_DEFAULT_ADDRESS -#define DBUS_SESSION_BUS_DEFAULT_ADDRESS "autolaunch:" -#endif - void _dbus_warn (const char *format, ...) _DBUS_GNUC_PRINTF (1, 2); |