From 727349248f908d5d2a523e65c0e0dca30b4996d2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 10 Oct 2013 13:14:01 +0100 Subject: start dbus-specification 0.23 --- doc/dbus-specification.xml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index bc374b9b..125001ad 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -6,8 +6,8 @@
D-Bus Specification - Version 0.22 - 2013-10-09 + Version 0.23 + (not yet released) Havoc @@ -71,6 +71,14 @@ + + 0.23 + not yet released + + + see commit log + + 0.22 2013-10-09 -- cgit v1.2.3 From c92dffe6ab4acd58eca4516eed7f762d683c0982 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 1 Nov 2013 20:17:52 +0000 Subject: start on 1.7.10 --- NEWS | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 972d3984..825121f8 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +D-Bus 1.7.10 (UNRELEASED) +== + D-Bus 1.7.8 (2013-11-01) == diff --git a/configure.ac b/configure.ac index f759cf48..bae18118 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.63]) m4_define([dbus_major_version], [1]) m4_define([dbus_minor_version], [7]) -m4_define([dbus_micro_version], [8]) +m4_define([dbus_micro_version], [9]) m4_define([dbus_version], [dbus_major_version.dbus_minor_version.dbus_micro_version]) AC_INIT([dbus],[dbus_version],[https://bugs.freedesktop.org/enter_bug.cgi?product=dbus],[dbus]) -- cgit v1.2.3 From 7c00ed22d9b5c33f5b33221e906946b11a9bde3b Mon Sep 17 00:00:00 2001 From: DreamNik Date: Sun, 29 Sep 2013 14:45:58 +0400 Subject: make_and_run_test_nodes: avoid undefined behaviour In code that looks like n[i] = v(&i), where v increments i, C leaves it undefined whether the old or new value of i is used to locate n[i]. As it happens, gcc used the pre-increment value of i, but MSVC used the post-increment value. Fix this by inserting a sequence point to disambiguate the intended order. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69924 Reviewed-by: Chengwei Yang Reviewed-by: Simon McVittie [wrote commit message, fixed whitespace -smcv] Signed-off-by: Simon McVittie --- dbus/dbus-marshal-recursive-util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dbus/dbus-marshal-recursive-util.c b/dbus/dbus-marshal-recursive-util.c index 95124140..a2aaaf93 100644 --- a/dbus/dbus-marshal-recursive-util.c +++ b/dbus/dbus-marshal-recursive-util.c @@ -1785,10 +1785,13 @@ make_and_run_test_nodes (void) start_next_test ("All values in one big toplevel %d iteration\n", 1); { TestTypeNode *nodes[N_VALUES]; + TestTypeNode *node; i = 0; - while ((nodes[i] = value_generator (&i))) - ; + while ((node = value_generator (&i))) + { + nodes[i - 1] = node; + } run_test_nodes (nodes, N_VALUES); -- cgit v1.2.3 From c9ebd602c1fa57ef67977407289adfa497f881a4 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 4 Nov 2013 11:44:34 +0000 Subject: NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index de4656d4..95c3c10c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ D-Bus 1.6.19 (UNRELEASED) == +Fixes: + +• fix undefined behaviour in a regression test (fd.o #69924, DreamNik) + D-Bus 1.6.18 (2013-11-01) == -- cgit v1.2.3 From ba088208bc0c35ca418a097a8482c4a7705f4a43 Mon Sep 17 00:00:00 2001 From: osmond sun Date: Wed, 6 Nov 2013 00:53:18 +0800 Subject: selinux: Use selinux_set_mapping() to avoid hardcoded constants for policy Previous to the introduction of selinux_set_mapping(), DBus pulled constants generated from the system's policy at build time. But this means it's impossible to replace the system policy without rebuilding userspace components. This patch maps from arbitrary class/perm indices used by D-Bus and the policy values and handles all the translation at runtime on avc_has_perm() calls. Bug: https://bugs.freedesktop.org/attachment.cgi?id=88719 Reviewed-By: Colin Walters Tested-By: Colin Walters --- bus/bus.c | 2 +- bus/selinux.c | 30 +++++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/bus/bus.c b/bus/bus.c index 307c1586..e24504c3 100644 --- a/bus/bus.c +++ b/bus/bus.c @@ -894,7 +894,7 @@ bus_context_new (const DBusString *config_file, if (!bus_selinux_full_init ()) { - bus_context_log (context, DBUS_SYSTEM_LOG_FATAL, "SELinux enabled but AVC initialization failed; check system log\n"); + bus_context_log (context, DBUS_SYSTEM_LOG_FATAL, "SELinux enabled but D-Bus initialization failed; check system log\n"); } if (!process_config_postinit (context, parser, error)) diff --git a/bus/selinux.c b/bus/selinux.c index 768e55ef..99994ca9 100644 --- a/bus/selinux.c +++ b/bus/selinux.c @@ -44,8 +44,6 @@ #include #include #include -#include -#include #include #include #include @@ -314,8 +312,27 @@ bus_selinux_pre_init (void) #endif } +/* + * Private Flask definitions; the order of these constants must + * exactly match that of the structure array below! + */ +/* security dbus class constants */ +#define SECCLASS_DBUS 1 + +/* dbus's per access vector constants */ +#define DBUS__ACQUIRE_SVC 1 +#define DBUS__SEND_MSG 2 + +#ifdef HAVE_SELINUX +static struct security_class_mapping dbus_map[] = { + { "dbus", { "acquire_svc", "send_msg", NULL } }, + { NULL } +}; +#endif /* HAVE_SELINUX */ + /** - * Initialize the user space access vector cache (AVC) for D-Bus and set up + * Establish dynamic object class and permission mapping and + * initialize the user space access vector cache (AVC) for D-Bus and set up * logging callbacks. */ dbus_bool_t @@ -334,6 +351,13 @@ bus_selinux_full_init (void) _dbus_verbose ("SELinux is enabled in this kernel.\n"); + if (selinux_set_mapping (dbus_map) < 0) + { + _dbus_warn ("Failed to set up security class mapping (selinux_set_mapping():%s).\n", + strerror (errno)); + return FALSE; + } + avc_entry_ref_init (&aeref); if (avc_init ("avc", &mem_cb, &log_cb, &thread_cb, &lock_cb) < 0) { -- cgit v1.2.3 From 03aeaccbffa97c9237b57ca067e3da7388862129 Mon Sep 17 00:00:00 2001 From: Radoslaw Pajak Date: Fri, 8 Nov 2013 13:51:32 +0100 Subject: fixed memory freeing if error during listing services Signed-off-by: Radoslaw Pajak Reviewed-by: Simon McVittie Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71526 --- bus/activation.c | 2 +- bus/services.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bus/activation.c b/bus/activation.c index fcb71337..ea48a26f 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -2179,7 +2179,7 @@ bus_activation_list_services (BusActivation *activation, error: for (j = 0; j < i; j++) - dbus_free (retval[i]); + dbus_free (retval[j]); dbus_free (retval); return FALSE; diff --git a/bus/services.c b/bus/services.c index 6f380fac..01a720ed 100644 --- a/bus/services.c +++ b/bus/services.c @@ -368,7 +368,7 @@ bus_registry_list_services (BusRegistry *registry, error: for (j = 0; j < i; j++) - dbus_free (retval[i]); + dbus_free (retval[j]); dbus_free (retval); return FALSE; -- cgit v1.2.3 From 4f1ed05afc1ed8088404993dedae57cd766cbbb6 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 12 Nov 2013 10:47:55 +0000 Subject: NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 95c3c10c..2bf70466 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,9 @@ D-Bus 1.6.19 (UNRELEASED) Fixes: +• don't leak memory on out-of-memory while listing activatable or + active services (fd.o #71526, Radoslaw Pajak) + • fix undefined behaviour in a regression test (fd.o #69924, DreamNik) D-Bus 1.6.18 (2013-11-01) -- cgit v1.2.3 From 7c86eb023b63d3b35d529509e30552fdaa0dbf7e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 12 Nov 2013 10:51:17 +0000 Subject: NEWS for the SELinux change --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index ccb83aed..6d7910ac 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,10 @@ Fixes: • fix undefined behaviour in a regression test (fd.o #69924, DreamNik) +• on SELinux systems, don't assume that SECCLASS_DBUS, DBUS__ACQUIRE_SVC + and DBUS__SEND_MSG are numerically equal to their values in the + reference policy (fd.o #88719, osmond sun) + D-Bus 1.7.8 (2013-11-01) == -- cgit v1.2.3 From eca9a5a29e287478625310630cecda8cc29310d8 Mon Sep 17 00:00:00 2001 From: Matt Fischer Date: Thu, 7 Nov 2013 18:00:46 -0600 Subject: Fix for MinGW build dbus-sysdeps-win.c makes use of a constant called PROCESS_QUERY_LIMITED_INFORMATION, which was added after Windows XP. There is code present to make sure the constant is not used when running on an XP system, but the constant is still required at build time. Unfortunately, the Windows headers provided by MinGW are old enough that they do not contain this constant, so building with MinGW fails. This patch adds a definition for the constant if one is not already present. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71366 Reviewed-by: Simon McVittie Reviewed-by: Ralf Habacker [altered comment to specify MinGW32 < 4, since mingw-w64 and MinGW 4.0+ do have this constant -smcv] --- dbus/dbus-sysdeps-win.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index 1c974c50..74a4e84e 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -81,6 +81,11 @@ extern BOOL WINAPI ConvertSidToStringSidA (PSID Sid, LPSTR *StringSid); #define O_BINARY 0 #endif +#ifndef PROCESS_QUERY_LIMITED_INFORMATION +/* MinGW32 < 4 does not define this value in its headers */ +#define PROCESS_QUERY_LIMITED_INFORMATION (0x1000) +#endif + typedef int socklen_t; -- cgit v1.2.3 From 951b9700d5ec21cd4ef86bbe59dc7976d14283ac Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Fri, 15 Nov 2013 09:20:31 +0800 Subject: Fix dbus_shutdown API document: returns --> frees https://bugs.freedesktop.org/show_bug.cgi?id=71627 Reviewed-by: Simon McVittie --- dbus/dbus-memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbus/dbus-memory.c b/dbus/dbus-memory.c index d59e8f8c..22e80727 100644 --- a/dbus/dbus-memory.c +++ b/dbus/dbus-memory.c @@ -856,7 +856,7 @@ _dbus_register_shutdown_func_unlocked (DBusShutdownFunction func, * can be useful to free these internal data structures. * * dbus_shutdown() does NOT free memory that was returned - * to the application. It only returns libdbus-internal + * to the application. It only frees libdbus-internal * data structures. * * You MUST free all memory and release all reference counts -- cgit v1.2.3 From ac502b5cdd17f6819ec8d1f935871139767f0944 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Tue, 19 Nov 2013 18:13:01 +0800 Subject: Fix api doc for _dbus_spawn_async_with_babysitter Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71820 Reviewed-by: Simon McVittie --- dbus/dbus-spawn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c index d1478f00..653776b5 100644 --- a/dbus/dbus-spawn.c +++ b/dbus/dbus-spawn.c @@ -1179,7 +1179,7 @@ babysit (pid_t grandchild_pid, * If sitter_p is #NULL, no babysitter is kept. * * @param sitter_p return location for babysitter or #NULL - * @log_name the name under which to log messages about this process being spawned + * @param log_name the name under which to log messages about this process being spawned * @param argv the executable and arguments * @param env the environment, or #NULL to copy the parent's * @param child_setup function to call in child pre-exec() -- cgit v1.2.3 From 00993d3702dfdb00970ac62fa793aa60cd7c162e Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Mon, 25 Nov 2013 20:53:44 +0800 Subject: Remove duplicate checking for pkg-config Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71985 Reviewed-by: Simon McVittie --- configure.ac | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure.ac b/configure.ac index bae18118..e37a6329 100644 --- a/configure.ac +++ b/configure.ac @@ -894,8 +894,6 @@ fi # unix:path=/foo or unix:abstract=/foo AC_SUBST(DBUS_PATH_OR_ABSTRACT) -PKG_PROG_PKG_CONFIG - #### Sort out XML library AC_CHECK_LIB(expat, XML_ParserCreate_MM, -- cgit v1.2.3 From 969f3918dcc4a4f6ad03dd078f9bb6a108846513 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Fri, 18 Oct 2013 13:46:45 +1300 Subject: Support printing unix file descriptors in dbus-send/dbus-monitor Bug: https://bugs.freedesktop.org/show_bug.cgi?id=70592 Reviewed-by: Chengwei Yang Reviewed-by: Simon McVittie --- tools/dbus-print-message.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/dbus-print-message.c b/tools/dbus-print-message.c index 75d00aca..e0dd2da6 100644 --- a/tools/dbus-print-message.c +++ b/tools/dbus-print-message.c @@ -346,7 +346,15 @@ print_iter (DBusMessageIter *iter, dbus_bool_t literal, int depth) printf("}\n"); break; } - + + case DBUS_TYPE_UNIX_FD: + { + int fd; + dbus_message_iter_get_basic (iter, &fd); + printf ("unix fd %d\n", fd); + break; + } + default: printf (" (dbus-monitor too dumb to decipher arg type '%c')\n", type); break; -- cgit v1.2.3 From 0fa46f68b8bbd2913ac9620328518fc5f9e16f85 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 16 Sep 2013 14:16:13 +0100 Subject: Do not require messages without INTERFACE to be dispatched Previously, if we have interfaces: interface com.example.foo: method Ambiguous() interface com.example.bar: method Ambiguous() method Unambiguous() implementations were required to deliver a message with no INTERFACE and METHOD=Unambiguous to "bar". A message with no INTERFACE and METHOD=Ambiguous could either be delivered to "foo", delivered to "bar" or treated as an error. Relax this to allow an error for the unambiguous case, too, and strongly recommend specifying the interface (which is best-practice). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68597 Reviewed-by: Chengwei Yang Vaguely-acked-by: Thiago Macieira, David Zeuthen [and desrt objected that it didn't go far enough] Signed-off-by: Simon McVittie --- doc/dbus-specification.xml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index 125001ad..865a8bff 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -1688,12 +1688,16 @@ A method call message is required to have a MEMBER header field indicating the name of the method. Optionally, the message has an - INTERFACE field giving the interface the method is a part of. In the - absence of an INTERFACE field, if two interfaces on the same object have - a method with the same name, it is undefined which of the two methods - will be invoked. Implementations may also choose to return an error in - this ambiguous case. However, if a method name is unique - implementations must not require an interface field. + INTERFACE field giving the interface the method is a part of. + Including the INTERFACE in all method call + messages is strongly recommended. + + + In the absence of an INTERFACE field, if two + or more interfaces on the same object have a method with the same + name, it is undefined which of those methods will be invoked. + Implementations may choose to either return an error, or deliver the + message as though it had an arbitrary one of those interfaces. Method call messages also include a PATH field -- cgit v1.2.3 From 8c388a5d213aa28f5d92a19150a697c5eba5554f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 16 Sep 2013 14:17:25 +0100 Subject: spec: explicitly mention filtering messages with no INTERFACE This is an important security measure. Without it, the system bus would not deliver its intended security properties. The actual implementation has always behaved like this, I think. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68597 Reviewed-by: Chengwei Yang --- doc/dbus-specification.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index 865a8bff..629ab10c 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -1699,6 +1699,15 @@ Implementations may choose to either return an error, or deliver the message as though it had an arbitrary one of those interfaces. + + In some situations (such as the well-known system bus), messages + are filtered through an access-control list external to the + remote object implementation. If that filter rejects certain + messages by matching their interface, or accepts only messages + to specific interfaces, it must also reject messages that have no + INTERFACE: otherwise, malicious + applications could use this to bypass the filter. + Method call messages also include a PATH field indicating the object to invoke the method on. If the call is passing -- cgit v1.2.3 From 87f37d6d9860f3afe1a7b63cd5ba1411b817f5c0 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Wed, 20 Nov 2013 22:25:52 +0800 Subject: _dbus_append_address_from_socket(): escape value got from socket fd So far, this bug can be triggered in systemd environment, if the configured ListenStream for dbus.socket has characters must be escaped first. Then we'll get an error like "In D-Bus address, character '%c' should have been escaped\n" Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46013 Reviewed-by: Simon McVittie --- dbus/dbus-sysdeps-unix.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 07080045..b82c2bc7 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -4050,6 +4050,7 @@ _dbus_append_address_from_socket (int fd, } socket; char hostip[INET6_ADDRSTRLEN]; int size = sizeof (socket); + DBusString path_str; if (getsockname (fd, &socket.sa, &size)) goto err; @@ -4059,26 +4060,32 @@ _dbus_append_address_from_socket (int fd, case AF_UNIX: if (socket.un.sun_path[0]=='\0') { - if (_dbus_string_append_printf (address, "unix:abstract=%s", &(socket.un.sun_path[1]))) + _dbus_string_init_const (&path_str, &(socket.un.sun_path[1])); + if (_dbus_string_append (address, "unix:abstract=") && + _dbus_address_append_escaped (address, &path_str)) return TRUE; } else { - if (_dbus_string_append_printf (address, "unix:path=%s", socket.un.sun_path)) + _dbus_string_init_const (&path_str, socket.un.sun_path); + if (_dbus_string_append (address, "unix:path=") && + _dbus_address_append_escaped (address, &path_str)) return TRUE; } break; case AF_INET: if (inet_ntop (AF_INET, &socket.ipv4.sin_addr, hostip, sizeof (hostip))) if (_dbus_string_append_printf (address, "tcp:family=ipv4,host=%s,port=%u", - hostip, ntohs (socket.ipv4.sin_port))) + hostip, ntohs (socket.ipv4.sin_port))) return TRUE; break; #ifdef AF_INET6 case AF_INET6: + _dbus_string_init_const (&path_str, hostip); if (inet_ntop (AF_INET6, &socket.ipv6.sin6_addr, hostip, sizeof (hostip))) - if (_dbus_string_append_printf (address, "tcp:family=ipv6,host=%s,port=%u", - hostip, ntohs (socket.ipv6.sin6_port))) + if (_dbus_string_append_printf (address, "tcp:family=ipv6,port=%u,host=", + ntohs (socket.ipv6.sin6_port)) && + _dbus_address_append_escaped (address, &path_str)) return TRUE; break; #endif -- cgit v1.2.3 From 08e8ff0f3a8b87e42b2313ed4abc9bb2a317f118 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Tue, 2 Jul 2013 09:27:48 +0800 Subject: cmake: fix code style Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66453 Signed-off-by: Chengwei Yang Reviewed-by: Ralf Habacker --- cmake/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index fe111966..bf5ef2b1 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -540,18 +540,18 @@ message(" Docbook Generator: ${DOCBOOK_GENERATOR_NAME} " message(" gcc coverage profiling: ${DBUS_GCOV_ENABLED} ") message(" Building unit tests: ${DBUS_BUILD_TESTS} ") message(" Building verbose mode: ${DBUS_ENABLE_VERBOSE_MODE} ") -message(" Building w/o assertions: ${DBUS_DISABLE_ASSERT} ") +message(" Building w/o assertions: ${DBUS_DISABLE_ASSERT} ") message(" Building w/o checks: ${DBUS_DISABLE_CHECKS} ") message(" Building bus stats API: ${DBUS_ENABLE_STATS} ") message(" installing system libs: ${DBUS_INSTALL_SYSTEM_LIBS} ") message(" Building inotify support: ${DBUS_BUS_ENABLE_INOTIFY} ") -message(" Building kqueue support: ${DBUS_BUS_ENABLE_KQUEUE} ") +message(" Building kqueue support: ${DBUS_BUS_ENABLE_KQUEUE} ") message(" Building Doxygen docs: ${DBUS_ENABLE_DOXYGEN_DOCS} ") message(" Building XML docs: ${DBUS_ENABLE_XML_DOCS} ") message(" Daemon executable name: ${DBUS_DAEMON_NAME}") if (WIN32) message(" System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS} ") -message(" Session bus listens on: ${DBUS_SESSION_BUS_LISTEN_ADDRESS} ") +message(" Session bus listens on: ${DBUS_SESSION_BUS_LISTEN_ADDRESS} ") message(" Session clients connect to: ${DBUS_SESSION_BUS_CONNECT_ADDRESS} ") else (WIN32) message(" System bus socket: ${DBUS_SYSTEM_SOCKET} ") -- cgit v1.2.3 From 726b28a03eddc999e447310b0b4499a6621588ad Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Tue, 2 Jul 2013 09:28:02 +0800 Subject: cmake: update README.cmake a bit Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66453 Signed-off-by: Chengwei Yang Reviewed-by: Ralf Habacker --- README.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.cmake b/README.cmake index 4932e66b..c3c6a170 100644 --- a/README.cmake +++ b/README.cmake @@ -156,6 +156,18 @@ HAVE_CONSOLE_OWNER_FILE:BOOL=ON // Directory to check for console ownership DBUS_CONSOLE_OWNER_FILE:STRING=/dev/console +// Linux only: +// enable inotify as dir watch backend +DBUS_BUS_ENABLE_INOTIFY:BOOL=ON + +*BSD only: +// enable kqueue as dir watch backend +DBUS_BUS_ENABLE_KQUEUE:BOOL=ON + +not available on windows: +// enable abstract socket transport +DBUS_ENABLE_ABSTRACT_SOCKETS:BOOL=ON + x11 only: // Build with X11 auto launch support DBUS_BUILD_X11:BOOL=ON -- cgit v1.2.3 From 72c42279f63d0dd85df7a4ca2791e55f9f074a87 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 27 Nov 2013 16:40:22 +0000 Subject: NEWS --- NEWS | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/NEWS b/NEWS index ecd2f408..3cc46d2a 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,11 @@ D-Bus 1.7.10 (UNRELEASED) == +D-Bus Specification 0.23: + +• don't require messages with no INTERFACE to be dispatched + (fd.o #68597, Simon McVittie) + Fixes: • don't leak memory on out-of-memory while listing activatable or @@ -8,10 +13,18 @@ Fixes: • fix undefined behaviour in a regression test (fd.o #69924, DreamNik) +• escape Unix socket addresses correctly (fd.o #46013, Chengwei Yang) + • on SELinux systems, don't assume that SECCLASS_DBUS, DBUS__ACQUIRE_SVC and DBUS__SEND_MSG are numerically equal to their values in the reference policy (fd.o #88719, osmond sun) +• define PROCESS_QUERY_LIMITED_INFORMATION if missing from MinGW < 4 headers + (fd.o #71366, Matt Fischer) + +• support printing Unix file descriptors in dbus-send, dbus-monitor + (fd.o #70592, Robert Ancell) + D-Bus 1.7.8 (2013-11-01) == -- cgit v1.2.3 From 723da23545aa1b742c7ac37df6934040a805526b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 19 Feb 2013 13:45:50 +0000 Subject: specification: discuss "listenable" and "connectable" addresses The --with-dbus-session-bus-connect-address configure option and the DBUS_SESSION_BUS_CONNECT_ADDRESS CMake variable expect a connectable address, while the --with-dbus-session-bus-listen-address option and the DBUS_SESSION_BUS_LISTEN_ADDRESS variable expect a listenable address. DBUS_SYSTEM_BUS_DEFAULT_ADDRESS currently has to be an address that is simultaneously listenable and connectable. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61303 Reviewed-by: Chengwei Yang [fixed name of DBUS_SESSION_BUS_CONNECT_ADDRESS as per review -smcv] Signed-off-by: Simon McVittie --- doc/dbus-specification.xml | 91 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 86 insertions(+), 5 deletions(-) diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index 629ab10c..d1b8d473 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -2951,6 +2951,35 @@ unix:path=/tmp/dbus-test;unix:path=/tmp/dbus-test2 + + Some addresses are connectable. A connectable + address is one containing enough information for a client to connect + to it. For instance, tcp:host=127.0.0.1,port=4242 + is a connectable address. It is not necessarily possible to listen + on every connectable address: for instance, it is not possible to + listen on a unixexec: address. + + + + Some addresses are listenable. A listenable + address is one containing enough information for a server to listen on + it, producing a connectable address (which may differ from the + original address). Many listenable addresses are not connectable: + for instance, tcp:host=127.0.0.1 + is listenable, but not connectable (because it does not specify + a port number). + + + + Listening on an address that is not connectable will result in a + connectable address that is not the same as the listenable address. + For instance, listening on tcp:host=127.0.0.1 + might result in the connectable address + tcp:host=127.0.0.1,port=30958, + or listening on unix:tmpdir=/tmp + might result in the connectable address + unix:abstract=/tmp/dbus-U8OSdmf7. + @@ -2983,6 +3012,13 @@ Unix domain sockets are not available on Windows. + + Unix addresses that specify path or + abstract are both listenable and connectable. + Unix addresses that specify tmpdir are only + listenable: the corresponding connectable address will specify + either path or abstract. + Server Address Format @@ -3012,11 +3048,16 @@ abstract (string) - unique string (path) in the abstract namespace. If set, the "path" or "tempdir" key must not be set. + unique string (path) in the abstract namespace. If set, the "path" or "tmpdir" key must not be set. This key is only supported on platforms with "abstract Unix sockets", of which Linux is the only known example. + + Exactly one of the keys path, + abstract or + tmpdir must be provided. + @@ -3040,6 +3081,9 @@ launchd is not available on Microsoft Windows. + + launchd addresses are listenable and connectable. + Server Address Format @@ -3064,6 +3108,9 @@ + + The env key is required. + @@ -3086,6 +3133,11 @@ The systemd transport defines no parameter keys. + + systemd addresses are listenable, but not connectable. The + corresponding connectable address is the unix + or tcp address of the socket. + TCP Sockets @@ -3098,9 +3150,16 @@ over a network is unsecure. - Windows notes: Because of the tcp stack on Windows does not provide sending - credentials over a tcp connection, the EXTERNAL authentification - mechanismus does not work. + On Windows and most Unix platforms, the TCP stack is unable to transfer + credentials over a TCP connection, so the EXTERNAL authentication + mechanism does not work for this transport. + + + All tcp addresses are listenable. + tcp addresses in which both + host and port are + specified, and port is non-zero, + are also connectable. Server Address Format @@ -3172,6 +3231,12 @@ key-value pair and send it over the socket. After that, the transport behaves like an unsecured tcp transport. + + All nonce-tcp addresses are listenable. nonce-tcp addresses in which + host, port and + noncefile are all specified, + and port is nonzero, are also connectable. + Server Address Format @@ -3209,7 +3274,10 @@ noncefile (path) - file location containing the secret + File location containing the secret. + This is only meaningful in connectable addresses: + a listening D-Bus server that offers this transport + will always create a new nonce file. @@ -3232,6 +3300,10 @@ Executed subprocesses are not available on Windows. + + unixexec addresses are connectable, but are not + listenable. + Server Address Format @@ -3290,6 +3362,15 @@ The autolaunch transport provides a way for dbus clients to autodetect a running dbus session bus and to autolaunch a session bus if not present. + + On Unix, autolaunch addresses are connectable, + but not listenable. + + + On Windows, autolaunch addresses are both + connectable and listenable. + + Server Address Format -- cgit v1.2.3 From 00211794ed8e85cb49538ee32703f71566cb48f2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 19 Feb 2013 15:40:06 +0000 Subject: _dbus_check_dir_is_private_to_user: check that we own it Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61303 Reviewed-by: Chengwei Yang Signed-off-by: Simon McVittie --- dbus/dbus-sysdeps-unix.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index b82c2bc7..19f5ea30 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1999,6 +1999,16 @@ _dbus_check_dir_is_private_to_user (DBusString *dir, DBusError *error) return FALSE; } + if (sb.st_uid != geteuid ()) + { + dbus_set_error (error, DBUS_ERROR_FAILED, + "%s directory is owned by user %lu, not %lu", + directory, + (unsigned long) sb.st_uid, + (unsigned long) geteuid ()); + return FALSE; + } + if ((S_IROTH & sb.st_mode) || (S_IWOTH & sb.st_mode) || (S_IRGRP & sb.st_mode) || (S_IWGRP & sb.st_mode)) { -- cgit v1.2.3 From 1794c245e2869c5f7d35f38c38b42f17c157541f Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Tue, 10 Dec 2013 17:11:25 +0800 Subject: Reload policy rules for completed connections The message bus which can monitor its conf dirs for changes and reload confs immediately if dir monitor enabled, for example, inotify in Linux, kqueue in *BSD. However, it doesn't apply policy rules change for completed connections, so to apply policy rules change, the client connection has to disconnect first and then re-connect to message bus. For imcomplete connections, it always has the latest review of policy rules. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39463 Reviewed-by: Simon McVittie --- bus/bus.c | 12 ++++++++++++ bus/connection.c | 36 ++++++++++++++++++++++++++++++++++++ bus/connection.h | 2 ++ 3 files changed, 50 insertions(+) diff --git a/bus/bus.c b/bus/bus.c index e24504c3..a514e31d 100644 --- a/bus/bus.c +++ b/bus/bus.c @@ -526,6 +526,18 @@ process_config_every_time (BusContext *context, context->policy = bus_config_parser_steal_policy (parser); _dbus_assert (context->policy != NULL); + /* context->connections is NULL when creating new BusContext */ + if (context->connections) + { + _dbus_verbose ("Reload policy rules for completed connections\n"); + retval = bus_connections_reload_policy (context->connections, error); + if (!retval) + { + _DBUS_ASSERT_ERROR_IS_SET (error); + goto failed; + } + } + /* We have to build the address backward, so that * later in the config file have priority */ diff --git a/bus/connection.c b/bus/connection.c index fddbc78a..8d741d6f 100644 --- a/bus/connection.c +++ b/bus/connection.c @@ -1435,6 +1435,42 @@ fail: return FALSE; } +dbus_bool_t +bus_connections_reload_policy (BusConnections *connections, + DBusError *error) +{ + BusConnectionData *d; + DBusConnection *connection; + DBusList *link; + + _dbus_assert (connections != NULL); + _DBUS_ASSERT_ERROR_IS_CLEAR (error); + + for (link = _dbus_list_get_first_link (&(connections->completed)); + link; + link = _dbus_list_get_next_link (&(connections->completed), link)) + { + connection = link->data; + d = BUS_CONNECTION_DATA (connection); + _dbus_assert (d != NULL); + _dbus_assert (d->policy != NULL); + + bus_client_policy_unref (d->policy); + d->policy = bus_context_create_client_policy (connections->context, + connection, + error); + if (d->policy == NULL) + { + _dbus_verbose ("Failed to create security policy for connection %p\n", + connection); + _DBUS_ASSERT_ERROR_IS_SET (error); + return FALSE; + } + } + + return TRUE; +} + const char * bus_connection_get_name (DBusConnection *connection) { diff --git a/bus/connection.h b/bus/connection.h index c9360212..13c8b99f 100644 --- a/bus/connection.h +++ b/bus/connection.h @@ -45,6 +45,8 @@ void bus_connections_foreach_active (BusConnections void *data); BusContext* bus_connections_get_context (BusConnections *connections); void bus_connections_increment_stamp (BusConnections *connections); +dbus_bool_t bus_connections_reload_policy (BusConnections *connections, + DBusError *error); BusContext* bus_connection_get_context (DBusConnection *connection); BusConnections* bus_connection_get_connections (DBusConnection *connection); BusRegistry* bus_connection_get_registry (DBusConnection *connection); -- cgit v1.2.3 From 2d950f6e9a412da70e9f8bc956980abc949a5fe8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 19 Feb 2013 16:39:38 +0000 Subject: Make sure tests run with a temporary XDG_RUNTIME_DIR We don't want the regression tests' "session" getting mixed up in system-wide "sessions". This doesn't actually matter yet, but it is likely to matter in future. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61301 Reviewed-by: Chengwei Yang [merged with earlier line-wrapping of TESTS_ENVIRONMENT -smcv] Signed-off-by: Simon McVittie --- test/Makefile.am | 4 +++- test/name-test/Makefile.am | 2 ++ test/name-test/run-test-systemserver.sh | 5 +++++ test/name-test/run-test.sh | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/test/Makefile.am b/test/Makefile.am index 870ce321..426a72e0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -149,11 +149,13 @@ endif DBUS_WITH_GLIB installcheck_tests = installcheck_environment = \ + XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \ DBUS_TEST_DAEMON=$(DESTDIR)$(DBUS_DAEMONDIR)/dbus-daemon$(EXEEXT) \ DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus \ DBUS_TEST_SYSCONFDIR=$(DESTDIR)$(sysconfdir) TESTS_ENVIRONMENT = \ + XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \ DBUS_BLOCK_ON_ABORT=1 \ DBUS_FATAL_WARNINGS=1 \ DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT) \ @@ -368,7 +370,7 @@ imported_data = \ $(NULL) noinst_DATA = $(imported_data) -CLEANFILES = $(noinst_DATA) +CLEANFILES = $(noinst_DATA) XDG_RUNTIME_DIR $(imported_data): data/valid-config-files/%.conf: $(top_builddir)/bus/%.conf $(AM_V_at)$(MKDIR_P) data/valid-config-files diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am index da41e58b..8ed1e160 100644 --- a/test/name-test/Makefile.am +++ b/test/name-test/Makefile.am @@ -19,7 +19,9 @@ TESTS_ENVIRONMENT = \ PYTHON=@PYTHON@ \ DBUS_TEST_DATA=@abs_top_builddir@/test/data \ DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT) \ + XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \ $(NULL) + TESTS=run-test.sh run-test-systemserver.sh else TESTS= diff --git a/test/name-test/run-test-systemserver.sh b/test/name-test/run-test-systemserver.sh index afd1f045..90c03723 100755 --- a/test/name-test/run-test-systemserver.sh +++ b/test/name-test/run-test-systemserver.sh @@ -30,6 +30,11 @@ if test -n "$DBUS_TEST_MONITOR"; then dbus-monitor --session & fi +XDG_RUNTIME_DIR="$DBUS_TOP_BUILDDIR"/test/XDG_RUNTIME_DIR +test -d "$XDG_RUNTIME_DIR" || mkdir "$XDG_RUNTIME_DIR" +chmod 0700 "$XDG_RUNTIME_DIR" +export XDG_RUNTIME_DIR + echo "running test-expected-echo-fail" ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/tools/dbus-send --print-reply --dest=org.freedesktop.DBus.TestSuiteEchoService /org/freedesktop/TestSuite org.freedesktop.TestSuite.Echo string:hi >echo-error-output.tmp 2>&1 if ! grep -q 'DBus.Error' echo-error-output.tmp; then diff --git a/test/name-test/run-test.sh b/test/name-test/run-test.sh index cad5937e..84379c4a 100755 --- a/test/name-test/run-test.sh +++ b/test/name-test/run-test.sh @@ -30,6 +30,11 @@ if test -n "$DBUS_TEST_MONITOR"; then dbus-monitor --session & fi +XDG_RUNTIME_DIR="$DBUS_TOP_BUILDDIR"/test/XDG_RUNTIME_DIR +test -d "$XDG_RUNTIME_DIR" || mkdir "$XDG_RUNTIME_DIR" +chmod 0700 "$XDG_RUNTIME_DIR" +export XDG_RUNTIME_DIR + echo "running test-ids" ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-ids || die "test-ids failed" -- cgit v1.2.3 From 653790c9858180baf4259b38c7c9d5196e39114b Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Sun, 1 Dec 2013 19:40:21 +0800 Subject: kqueue: replace tab with space Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69332 [altered commit message to not say it fixes memory leaks -smcv] Reviewed-by: Simon McVittie --- bus/dir-watch-kqueue.c | 102 ++++++++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/bus/dir-watch-kqueue.c b/bus/dir-watch-kqueue.c index c60560f0..065fabb3 100644 --- a/bus/dir-watch-kqueue.c +++ b/bus/dir-watch-kqueue.c @@ -73,12 +73,12 @@ _handle_kqueue_watch (DBusWatch *watch, unsigned int flags, void *data) { kq = -1; if (watch != NULL) - { - _dbus_loop_remove_watch (loop, watch); + { + _dbus_loop_remove_watch (loop, watch); _dbus_watch_invalidate (watch); _dbus_watch_unref (watch); - watch = NULL; - } + watch = NULL; + } pid = getpid (); _dbus_verbose ("Sending SIGHUP signal since kqueue has been closed\n"); (void) kill (pid, SIGHUP); @@ -99,32 +99,32 @@ _init_kqueue (BusContext *context) if (kq < 0) { _dbus_warn ("Cannot create kqueue; error '%s'\n", _dbus_strerror (errno)); - goto out; - } - - loop = bus_context_get_loop (context); - - watch = _dbus_watch_new (kq, DBUS_WATCH_READABLE, TRUE, - _handle_kqueue_watch, NULL, NULL); - - if (watch == NULL) - { - _dbus_warn ("Unable to create kqueue watch\n"); - close (kq); - kq = -1; - goto out; - } - - if (!_dbus_loop_add_watch (loop, watch)) - { - _dbus_warn ("Unable to add reload watch to main loop"); - _dbus_watch_invalidate (watch); - _dbus_watch_unref (watch); - watch = NULL; - close (kq); - kq = -1; - goto out; - } + goto out; + } + + loop = bus_context_get_loop (context); + + watch = _dbus_watch_new (kq, DBUS_WATCH_READABLE, TRUE, + _handle_kqueue_watch, NULL, NULL); + + if (watch == NULL) + { + _dbus_warn ("Unable to create kqueue watch\n"); + close (kq); + kq = -1; + goto out; + } + + if (!_dbus_loop_add_watch (loop, watch)) + { + _dbus_warn ("Unable to add reload watch to main loop"); + _dbus_watch_invalidate (watch); + _dbus_watch_unref (watch); + watch = NULL; + close (kq); + kq = -1; + goto out; + } } ret = 1; @@ -169,12 +169,12 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories) if (dirs[j] && strcmp (new_dirs[i], dirs[j]) == 0) { new_fds[i] = fds[j]; - new_dirs[i] = dirs[j]; - fds[j] = -1; - dirs[j] = NULL; - break; - } - } + new_dirs[i] = dirs[j]; + fds[j] = -1; + dirs[j] = NULL; + break; + } + } } /* Any directory we find in "fds" with a nonzero fd must @@ -185,10 +185,10 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories) if (fds[j] != -1) { close (fds[j]); - dbus_free (dirs[j]); - fds[j] = -1; - dirs[j] = NULL; - } + dbus_free (dirs[j]); + fds[j] = -1; + dirs[j] = NULL; + } } for (i = 0; new_dirs[i]; i++) @@ -196,8 +196,8 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories) if (new_fds[i] == -1) { /* FIXME - less lame error handling for failing to add a watch; - * we may need to sleep. - */ + * we may need to sleep. + */ fd = open (new_dirs[i], O_RDONLY); if (fd < 0) { @@ -223,18 +223,18 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories) goto out; } - new_fds[i] = fd; - new_dirs[i] = _dbus_strdup (new_dirs[i]); - if (!new_dirs[i]) + new_fds[i] = fd; + new_dirs[i] = _dbus_strdup (new_dirs[i]); + if (!new_dirs[i]) { /* FIXME have less lame handling for OOM, we just silently fail to - * watch. (In reality though, the whole OOM handling in dbus is - * stupid but we won't go into that in this comment =) ) - */ + * watch. (In reality though, the whole OOM handling in dbus is + * stupid but we won't go into that in this comment =) ) + */ close (fd); - new_fds[i] = -1; - } - } + new_fds[i] = -1; + } + } } num_fds = i; -- cgit v1.2.3 From 4e8032be4e6608163757b2ab926e44e5f784807d Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Tue, 3 Dec 2013 20:47:54 +0800 Subject: Fix memory leak for kqueue: shutdown kqueue correctly There are memory blocks leak when doing bus-test, both dispatch-sha1 and dispatch test cases complain memory blocks leak. This patch also fix fd leaks. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69332 Reviewed-by: Simon McVittie --- bus/dir-watch-kqueue.c | 87 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/bus/dir-watch-kqueue.c b/bus/dir-watch-kqueue.c index 065fabb3..4cc780de 100644 --- a/bus/dir-watch-kqueue.c +++ b/bus/dir-watch-kqueue.c @@ -87,11 +87,49 @@ _handle_kqueue_watch (DBusWatch *watch, unsigned int flags, void *data) return TRUE; } +static void _shutdown_kqueue (void *data) +{ + int i; + + if (kq < 0) + return; + + for (i = 0; i < MAX_DIRS_TO_WATCH; i++) + { + if (fds[i] >= 0) + { + close (fds[i]); + fds[i] = -1; + } + if (dirs[i] != NULL) + { + /* dbus_free() is necessary to pass memleak check */ + dbus_free (dirs[i]); + dirs[i] = NULL; + } + } + + if (loop) + { + _dbus_loop_remove_watch (loop, watch); + _dbus_loop_unref (loop); + loop = NULL; + } + + if (watch) + { + _dbus_watch_invalidate (watch); + _dbus_watch_unref (watch); + watch = NULL; + } + + close (kq); + kq = -1; +} + static int _init_kqueue (BusContext *context) { - int ret = 0; - if (kq < 0) { @@ -103,6 +141,7 @@ _init_kqueue (BusContext *context) } loop = bus_context_get_loop (context); + _dbus_loop_ref (loop); watch = _dbus_watch_new (kq, DBUS_WATCH_READABLE, TRUE, _handle_kqueue_watch, NULL, NULL); @@ -110,27 +149,49 @@ _init_kqueue (BusContext *context) if (watch == NULL) { _dbus_warn ("Unable to create kqueue watch\n"); - close (kq); - kq = -1; - goto out; + goto out1; } if (!_dbus_loop_add_watch (loop, watch)) { _dbus_warn ("Unable to add reload watch to main loop"); - _dbus_watch_invalidate (watch); - _dbus_watch_unref (watch); - watch = NULL; - close (kq); - kq = -1; - goto out; + goto out2; + } + + if (!_dbus_register_shutdown_func (_shutdown_kqueue, NULL)) + { + _dbus_warn ("Unable to register shutdown function"); + goto out3; } } - ret = 1; + return 1; + +out3: + _dbus_loop_remove_watch (loop, watch); + +out2: + if (watch) + { + _dbus_watch_invalidate (watch); + _dbus_watch_unref (watch); + watch = NULL; + } + +out1: + if (kq >= 0) + { + close (kq); + kq = -1; + } + if (loop) + { + _dbus_loop_unref (loop); + loop = NULL; + } out: - return ret; + return 0; } void -- cgit v1.2.3 From 3ca8a53e336a1a829bae93c70fe617af6493201a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 18 Sep 2013 17:51:53 +0100 Subject: If sendmsg() with SCM_CREDS fails with EINVAL, retry with send() Perhaps some OSs accept and ignore attempts to send a SCM_CREDS message on a non-Unix socket, but GNU/kFreeBSD doesn't (and presumably FreeBSD doesn't either). Based on a patch by Svante Signell. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69492 Tested-by: Svante Signell Reviewed-by: Chengwei Yang --- dbus/dbus-sysdeps-unix.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 19f5ea30..c12f294e 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1572,13 +1572,19 @@ write_credentials_byte (int server_fd, |MSG_NOSIGNAL #endif ); -#else - bytes_written = send (server_fd, buf, 1, 0 -#if HAVE_DECL_MSG_NOSIGNAL - |MSG_NOSIGNAL + + /* If we HAVE_CMSGCRED, the OS still might not let us sendmsg() + * with a SOL_SOCKET/SCM_CREDS message - for instance, FreeBSD + * only allows that on AF_UNIX. Try just doing a send() instead. */ + if (bytes_written < 0 && errno == EINVAL) #endif - ); + { + bytes_written = send (server_fd, buf, 1, 0 +#if HAVE_DECL_MSG_NOSIGNAL + |MSG_NOSIGNAL #endif + ); + } if (bytes_written < 0 && errno == EINTR) goto again; -- cgit v1.2.3 From a6bb4b7be996b935ddc6a20d2fa8e5bb2a9e36f5 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 6 Jan 2014 15:55:35 +0000 Subject: _dbus_read_credentials_socket: look at all cmsg headers, not just the first If there are no cmsg headers, don't fail: this fixes receiving credentials on TCP sockets under at least GNU/kFreeBSD, and probably FreeBSD too. If there's more than one cmsg header, ignore any that don't look like valid SCM_CREDS. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69492 Tested-by: Svante Signell Reviewed-by: Chengwei Yang [added break, altered indentation in response to review -smcv] Signed-off-by: Simon McVittie --- dbus/dbus-sysdeps-unix.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index c12f294e..6fd1b764 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1712,16 +1712,6 @@ _dbus_read_credentials_socket (int client_fd, return FALSE; } -#if defined(HAVE_CMSGCRED) - if (cmsg.hdr.cmsg_len < CMSG_LEN (sizeof (struct cmsgcred)) - || cmsg.hdr.cmsg_type != SCM_CREDS) - { - dbus_set_error (error, DBUS_ERROR_FAILED, - "Message from recvmsg() was not SCM_CREDS"); - return FALSE; - } -#endif - _dbus_verbose ("read credentials byte\n"); { @@ -1762,10 +1752,22 @@ _dbus_read_credentials_socket (int client_fd, * which makes it better than getpeereid(). */ struct cmsgcred *cred; + struct cmsghdr *cmsgp; - cred = (struct cmsgcred *) CMSG_DATA (&cmsg.hdr); - pid_read = cred->cmcred_pid; - uid_read = cred->cmcred_euid; + for (cmsgp = CMSG_FIRSTHDR (&msg); + cmsgp != NULL; + cmsgp = CMSG_NXTHDR (&msg, cmsgp)) + { + if (cmsgp->cmsg_type == SCM_CREDS && + cmsgp->cmsg_level == SOL_SOCKET && + cmsgp->cmsg_len >= CMSG_LEN (sizeof (struct cmsgcred))) + { + cred = (struct cmsgcred *) CMSG_DATA (cmsgp); + pid_read = cred->cmcred_pid; + uid_read = cred->cmcred_euid; + break; + } + } #elif defined(HAVE_GETPEERUCRED) /* Supported in at least Solaris >= 10. It should probably be higher -- cgit v1.2.3 From 14d72882c9b03bb5c2f96646847b4c9e431168b1 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 1 Nov 2013 13:51:13 +0000 Subject: _dbus_listen_unix_socket: don't try to set SO_REUSEADDR On Hurd, the setsockopt() fails. Svante Signell confirmed that on at least Linux and kFreeBSD, SO_REUSEADDR "succeeds" on Unix sockets, but doesn't have any practical effect; so rather than making the failure not issue a warning, we might as well not bother with the syscall at all. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69492 Reviewed-by: Chengwei Yang Signed-off-by: Simon McVittie --- dbus/dbus-sysdeps-unix.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 6fd1b764..ae42f56e 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -999,7 +999,6 @@ _dbus_listen_unix_socket (const char *path, int listen_fd; struct sockaddr_un addr; size_t path_len; - unsigned int reuseaddr; _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -1074,13 +1073,6 @@ _dbus_listen_unix_socket (const char *path, strncpy (addr.sun_path, path, path_len); } - reuseaddr = 1; - if (setsockopt (listen_fd, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(reuseaddr))==-1) - { - _dbus_warn ("Failed to set socket option\"%s\": %s", - path, _dbus_strerror (errno)); - } - if (bind (listen_fd, (struct sockaddr*) &addr, _DBUS_STRUCT_OFFSET (struct sockaddr_un, sun_path) + path_len) < 0) { dbus_set_error (error, _dbus_error_from_errno (errno), -- cgit v1.2.3 From b2a517040cd6f0fcc676abe833675d5473820226 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Mon, 11 Nov 2013 17:52:26 +0800 Subject: _dbus_auth_return_buffer(): remove unused argument The argument bytes_read of _dbus_auth_return_buffer() function isn't used at all, so remove it. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71477 Reviewed-by: Simon McVittie --- dbus/dbus-auth-script.c | 4 ++-- dbus/dbus-auth.c | 4 +--- dbus/dbus-auth.h | 3 +-- dbus/dbus-transport-socket.c | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dbus/dbus-auth-script.c b/dbus/dbus-auth-script.c index c1f0c88e..164743b0 100644 --- a/dbus/dbus-auth-script.c +++ b/dbus/dbus-auth-script.c @@ -584,11 +584,11 @@ _dbus_auth_script_run (const DBusString *filename) { _dbus_warn ("not enough memory to call bytes_received, or can't add bytes to auth object already in end state\n"); _dbus_string_free (&to_send); - _dbus_auth_return_buffer (auth, buffer, 0); + _dbus_auth_return_buffer (auth, buffer); goto out; } - _dbus_auth_return_buffer (auth, buffer, _dbus_string_get_length (&to_send)); + _dbus_auth_return_buffer (auth, buffer); } _dbus_string_free (&to_send); diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c index a0f72773..6a07665f 100644 --- a/dbus/dbus-auth.c +++ b/dbus/dbus-auth.c @@ -2533,12 +2533,10 @@ _dbus_auth_get_buffer (DBusAuth *auth, * * @param auth the auth conversation * @param buffer the buffer being returned - * @param bytes_read number of new bytes added */ void _dbus_auth_return_buffer (DBusAuth *auth, - DBusString *buffer, - int bytes_read) + DBusString *buffer) { _dbus_assert (buffer == &auth->incoming); _dbus_assert (auth->buffer_outstanding); diff --git a/dbus/dbus-auth.h b/dbus/dbus-auth.h index ae3f3647..ba1975f7 100644 --- a/dbus/dbus-auth.h +++ b/dbus/dbus-auth.h @@ -55,8 +55,7 @@ void _dbus_auth_bytes_sent (DBusAuth *auth, void _dbus_auth_get_buffer (DBusAuth *auth, DBusString **buffer); void _dbus_auth_return_buffer (DBusAuth *auth, - DBusString *buffer, - int bytes_read); + DBusString *buffer); void _dbus_auth_get_unused_bytes (DBusAuth *auth, const DBusString **str); void _dbus_auth_delete_unused_bytes (DBusAuth *auth); diff --git a/dbus/dbus-transport-socket.c b/dbus/dbus-transport-socket.c index 44c7af7d..774f4598 100644 --- a/dbus/dbus-transport-socket.c +++ b/dbus/dbus-transport-socket.c @@ -255,8 +255,7 @@ read_data_into_auth (DBusTransport *transport, bytes_read = _dbus_read_socket (socket_transport->fd, buffer, socket_transport->max_bytes_read_per_iteration); - _dbus_auth_return_buffer (transport->auth, buffer, - bytes_read > 0 ? bytes_read : 0); + _dbus_auth_return_buffer (transport->auth, buffer); if (bytes_read > 0) { -- cgit v1.2.3 From 854554c3a67b880ac92fa72c476b772cb5968b26 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Thu, 28 Nov 2013 09:17:38 +0800 Subject: BusTransaction: remove confusing getter of connections There is a DBusList* member of BusTransaction named "connections", while its getter function bus_transaction_get_connections() returns context->connections which in fact is a BusConnections pointer, this is quite confusing. Because this is what bus_context_get_connections() returns. This patch call out to bus_context_get_connections() directly and remove the then unused bus_transaction_get_connections(). https://bugs.freedesktop.org/show_bug.cgi?id=71597 Reviewed-by: Simon McVittie --- bus/connection.c | 6 ------ bus/connection.h | 1 - bus/dispatch.c | 2 +- bus/stats.c | 2 +- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/bus/connection.c b/bus/connection.c index 8d741d6f..ea2d155a 100644 --- a/bus/connection.c +++ b/bus/connection.c @@ -2026,12 +2026,6 @@ bus_transaction_get_context (BusTransaction *transaction) return transaction->context; } -BusConnections* -bus_transaction_get_connections (BusTransaction *transaction) -{ - return bus_context_get_connections (transaction->context); -} - dbus_bool_t bus_transaction_send_from_driver (BusTransaction *transaction, DBusConnection *connection, diff --git a/bus/connection.h b/bus/connection.h index 13c8b99f..9f4f9aea 100644 --- a/bus/connection.h +++ b/bus/connection.h @@ -122,7 +122,6 @@ typedef void (* BusTransactionCancelFunction) (void *data); BusTransaction* bus_transaction_new (BusContext *context); BusContext* bus_transaction_get_context (BusTransaction *transaction); -BusConnections* bus_transaction_get_connections (BusTransaction *transaction); dbus_bool_t bus_transaction_send (BusTransaction *transaction, DBusConnection *connection, DBusMessage *message); diff --git a/bus/dispatch.c b/bus/dispatch.c index 5fc0d112..7a61953f 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -133,7 +133,7 @@ bus_dispatch_matches (BusTransaction *transaction, } /* Now dispatch to others who look interested in this message */ - connections = bus_transaction_get_connections (transaction); + connections = bus_context_get_connections (context); dbus_error_init (&tmp_error); matchmaker = bus_context_get_matchmaker (context); diff --git a/bus/stats.c b/bus/stats.c index ec768ec7..2bf86d66 100644 --- a/bus/stats.c +++ b/bus/stats.c @@ -48,7 +48,7 @@ bus_stats_handle_get_stats (DBusConnection *connection, _DBUS_ASSERT_ERROR_IS_CLEAR (error); - connections = bus_transaction_get_connections (transaction); + connections = bus_context_get_connections (transaction->context); reply = _dbus_asv_new_method_return (message, &iter, &arr_iter); -- cgit v1.2.3 From f4618906b0dce251cdc3125b60239f7dd0df7183 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Mon, 2 Dec 2013 12:47:47 +0800 Subject: kqueue: open watched directories with close-on-exec flag [FreeBSD and OpenBSD contributors clarified that O_CLOEXEC has been supported for ~ 2 years on both, so for the moment we're assuming that every platform with kqueue also has working O_CLOEXEC. Please reopen the bug, with a tested patch that uses _dbus_fd_set_close_on_exec() instead, if this assumption turns out to be false. -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72213 Reviewed-by: Simon McVittie --- bus/dir-watch-kqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bus/dir-watch-kqueue.c b/bus/dir-watch-kqueue.c index 4cc780de..33d5e95d 100644 --- a/bus/dir-watch-kqueue.c +++ b/bus/dir-watch-kqueue.c @@ -259,7 +259,7 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories) /* FIXME - less lame error handling for failing to add a watch; * we may need to sleep. */ - fd = open (new_dirs[i], O_RDONLY); + fd = open (new_dirs[i], O_RDONLY | O_CLOEXEC); if (fd < 0) { if (errno != ENOENT) -- cgit v1.2.3 From 15a5b2637c73d8f6d30acf1517b00182f215eb35 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Fri, 6 Dec 2013 10:53:28 +0800 Subject: Ensure DBusError is set if _dbus_read_nonce() fail In _dbus_send_nonce() which call in _dbus_read_nonce() and assert on an error is set if _dbus_read_nonce() fail. However, in _dbus_read_nonce(), it may fail on fopen() and left error is unset. This will crash us if assertions hasn't been disabled. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72298 Reviewed-by: Simon McVittie --- dbus/dbus-nonce.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dbus/dbus-nonce.c b/dbus/dbus-nonce.c index ef037ef9..37f30f00 100644 --- a/dbus/dbus-nonce.c +++ b/dbus/dbus-nonce.c @@ -113,7 +113,15 @@ _dbus_read_nonce (const DBusString *fname, DBusString *nonce, DBusError* error) fp = fopen (_dbus_string_get_const_data (fname), "rb"); if (!fp) - return FALSE; + { + dbus_set_error (error, + _dbus_error_from_system_errno (), + "Failed to open %s for read: %s", + _dbus_string_get_const_data (fname), + _dbus_strerror_from_errno ()); + return FALSE; + } + nread = fread (buffer, 1, sizeof buffer - 1, fp); fclose (fp); if (!nread) -- cgit v1.2.3 From eeae8a6b1ca7375213ba06d311e10108794f21c3 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Fri, 6 Dec 2013 11:15:12 +0800 Subject: DBus Spec: replace tab with 8 spaces Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72301 Reviewed-by: Simon McVittie --- doc/dbus-specification.xml | 426 ++++++++++++++++++++++----------------------- 1 file changed, 213 insertions(+), 213 deletions(-) diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index d1b8d473..5043849f 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -10,44 +10,44 @@ (not yet released) - Havoc - Pennington - - Red Hat, Inc. -
- hp@pobox.com -
-
+ Havoc + Pennington + + Red Hat, Inc. +
+ hp@pobox.com +
+
- Anders - Carlsson - - CodeFactory AB -
+ Anders + Carlsson + + CodeFactory AB +
andersca@codefactory.se
-
+ - Alexander - Larsson - - Red Hat, Inc. -
+ Alexander + Larsson + + Red Hat, Inc. +
alexl@redhat.com
-
+ - Sven - Herzberg - - Imendio AB -
+ Sven + Herzberg + + Imendio AB +
sven@imendio.com
-
+ Simon @@ -765,14 +765,14 @@ 0 (ASCII NUL) Not a valid type code, used to terminate signatures - BYTE - 121 (ASCII 'y') - 8-bit unsigned integer + BYTE + 121 (ASCII 'y') + 8-bit unsigned integer + + BOOLEAN + 98 (ASCII 'b') + Boolean value, 0 is FALSE and 1 is TRUE. Everything else is invalid. - BOOLEAN - 98 (ASCII 'b') - Boolean value, 0 is FALSE and 1 is TRUE. Everything else is invalid. - INT16 110 (ASCII 'n') 16-bit signed integer @@ -780,7 +780,7 @@ UINT16 113 (ASCII 'q') 16-bit unsigned integer - + INT32 105 (ASCII 'i') 32-bit signed integer @@ -788,7 +788,7 @@ UINT32 117 (ASCII 'u') 32-bit unsigned integer - + INT64 120 (ASCII 'x') 64-bit signed integer @@ -1109,7 +1109,7 @@ 8 - + VARIANT The marshaled SIGNATURE of a single @@ -1119,7 +1119,7 @@ 1 (alignment of the signature) - + DICT_ENTRY Identical to STRUCT. @@ -1136,7 +1136,7 @@ file descriptor in the array of file descriptors that accompany the message. 4 - + @@ -1528,12 +1528,12 @@ - Interface names must contain at least one '.' (period) + Interface names must contain at least one '.' (period) character (and thus at least two elements). - Interface names must not begin with a '.' (period) character. - Interface names must not exceed the maximum name length. + Interface names must not begin with a '.' (period) character. + Interface names must not exceed the maximum name length. @@ -1592,12 +1592,12 @@ - Bus names must contain at least one '.' (period) + Bus names must contain at least one '.' (period) character (and thus at least two elements). - Bus names must not begin with a '.' (period) character. - Bus names must not exceed the maximum name length. + Bus names must not begin with a '.' (period) character. + Bus names must not exceed the maximum name length. @@ -1635,12 +1635,12 @@ Member (i.e. method or signal) names: - Must only contain the ASCII characters + Must only contain the ASCII characters "[A-Z][a-z][0-9]_" and may not begin with a digit. - Must not contain the '.' (period) character. - Must not exceed the maximum name length. - Must be at least 1 byte in length. + Must not contain the '.' (period) character. + Must not exceed the maximum name length. + Must be at least 1 byte in length. @@ -1984,23 +1984,23 @@ Commands from the client to the server are as follows: - AUTH [mechanism] [initial-response] - CANCEL - BEGIN - DATA <data in hex encoding> - ERROR [human-readable error explanation] - NEGOTIATE_UNIX_FD - + AUTH [mechanism] [initial-response] + CANCEL + BEGIN + DATA <data in hex encoding> + ERROR [human-readable error explanation] + NEGOTIATE_UNIX_FD + From server to client are as follows: - REJECTED <space-separated list of mechanism names> - OK <GUID in hex> - DATA <data in hex encoding> - ERROR - AGREE_UNIX_FD - + REJECTED <space-separated list of mechanism names> + OK <GUID in hex> + DATA <data in hex encoding> + ERROR + AGREE_UNIX_FD + Unofficial extensions to the command set must begin with the letters @@ -2230,18 +2230,18 @@
- Example of successful magic cookie authentication - + Example of successful magic cookie authentication + (MAGIC_COOKIE is a made up mechanism) C: AUTH MAGIC_COOKIE 3138363935333137393635383634 S: OK 1234deadbeef C: BEGIN -
+
- Example of finding out mechanisms then picking one - + Example of finding out mechanisms then picking one + C: AUTH S: REJECTED KERBEROS_V4 SKEY C: AUTH SKEY 7ab83f32ee @@ -2250,20 +2250,20 @@ S: OK 1234deadbeef C: BEGIN -
+
- Example of client sends unknown command then falls back to regular auth - + Example of client sends unknown command then falls back to regular auth + C: FOOBAR S: ERROR C: AUTH MAGIC_COOKIE 3736343435313230333039 S: OK 1234deadbeef C: BEGIN -
+
- Example of server doesn't support initial auth mechanism - + Example of server doesn't support initial auth mechanism + C: AUTH MAGIC_COOKIE 3736343435313230333039 S: REJECTED KERBEROS_V4 SKEY C: AUTH SKEY 7ab83f32ee @@ -2272,10 +2272,10 @@ S: OK 1234deadbeef C: BEGIN -
+
- Example of wrong password or the like followed by successful retry - + Example of wrong password or the like followed by successful retry + C: AUTH MAGIC_COOKIE 3736343435313230333039 S: REJECTED KERBEROS_V4 SKEY C: AUTH SKEY 7ab83f32ee @@ -2288,10 +2288,10 @@ S: OK 1234deadbeef C: BEGIN -
+
- Example of skey cancelled and restarted - + Example of skey cancelled and restarted + C: AUTH MAGIC_COOKIE 3736343435313230333039 S: REJECTED KERBEROS_V4 SKEY C: AUTH SKEY 7ab83f32ee @@ -2304,10 +2304,10 @@ S: OK 1234deadbeef C: BEGIN -
+
- Example of successful magic cookie authentication with successful negotiation of Unix FD passing - + Example of successful magic cookie authentication with successful negotiation of Unix FD passing + (MAGIC_COOKIE is a made up mechanism) C: AUTH MAGIC_COOKIE 3138363935333137393635383634 @@ -2316,10 +2316,10 @@ S: AGREE_UNIX_FD C: BEGIN -
+
- Example of successful magic cookie authentication with unsuccessful negotiation of Unix FD passing - + Example of successful magic cookie authentication with unsuccessful negotiation of Unix FD passing + (MAGIC_COOKIE is a made up mechanism) C: AUTH MAGIC_COOKIE 3138363935333137393635383634 @@ -2328,7 +2328,7 @@ S: ERROR C: BEGIN -
+
@@ -2997,17 +2997,17 @@ Unix Domain Sockets Unix domain sockets can be either paths in the file system or on Linux - kernels, they can be abstract which are similar to paths but - do not show up in the file system. + kernels, they can be abstract which are similar to paths but + do not show up in the file system. When a socket is opened by the D-Bus library it truncates the path - name right before the first trailing Nul byte. This is true for both - normal paths and abstract paths. Note that this is a departure from - previous versions of D-Bus that would create sockets with a fixed - length path name. Names which were shorter than the fixed length - would be padded by Nul bytes. + name right before the first trailing Nul byte. This is true for both + normal paths and abstract paths. Note that this is a departure from + previous versions of D-Bus that would create sockets with a fixed + length path name. Names which were shorter than the fixed length + would be padded by Nul bytes. Unix domain sockets are not available on Windows. @@ -3846,38 +3846,38 @@ Method, interface, property, and signal elements may have "annotations", which are generic key/value pairs of metadata. - They are similar conceptually to Java's annotations and C# attributes. + They are similar conceptually to Java's annotations and C# attributes. Well-known annotations: - - - Name - Values (separated by ,) - Description - - - - - org.freedesktop.DBus.Deprecated - true,false - Whether or not the entity is deprecated; defaults to false - - - org.freedesktop.DBus.GLib.CSymbol - (string) - The C symbol; may be used for methods and interfaces - - - org.freedesktop.DBus.Method.NoReply - true,false - If set, don't expect a reply to the method call; defaults to false. - - - org.freedesktop.DBus.Property.EmitsChangedSignal - true,invalidates,false - + + + Name + Values (separated by ,) + Description + + + + + org.freedesktop.DBus.Deprecated + true,false + Whether or not the entity is deprecated; defaults to false + + + org.freedesktop.DBus.GLib.CSymbol + (string) + The C symbol; may be used for methods and interfaces + + + org.freedesktop.DBus.Method.NoReply + true,false + If set, don't expect a reply to the method call; defaults to false. + + + org.freedesktop.DBus.Property.EmitsChangedSignal + true,invalidates,false + If set to false, the org.freedesktop.DBus.Properties.PropertiesChanged @@ -3902,8 +3902,8 @@ interface element. - - + + @@ -4016,11 +4016,11 @@ STRING Name to request - - 1 - UINT32 - Flags - + + 1 + UINT32 + Flags + @@ -4131,10 +4131,10 @@ - - DBUS_NAME_FLAG_ALLOW_REPLACEMENT - 0x1 - + + DBUS_NAME_FLAG_ALLOW_REPLACEMENT + 0x1 + If an application A specifies this flag and succeeds in becoming the owner of the name, and another application B @@ -4148,11 +4148,11 @@ application A as the owner. - - - DBUS_NAME_FLAG_REPLACE_EXISTING - 0x2 - + + + DBUS_NAME_FLAG_REPLACE_EXISTING + 0x2 + Try to replace the current owner if there is one. If this flag is not set the application will only become the owner of @@ -4161,11 +4161,11 @@ the current owner specified DBUS_NAME_FLAG_ALLOW_REPLACEMENT. - - - DBUS_NAME_FLAG_DO_NOT_QUEUE - 0x4 - + + + DBUS_NAME_FLAG_DO_NOT_QUEUE + 0x4 + Without this flag, if an application requests a name that is already owned, the application will be placed in a queue to @@ -4178,10 +4178,10 @@ became the name owner. - - - - + + + + The return code can be one of the following values: @@ -4195,41 +4195,41 @@ - + DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER - 1 The caller is now the primary owner of - the name, replacing any previous owner. Either the name had no - owner before, or the caller specified - DBUS_NAME_FLAG_REPLACE_EXISTING and the current owner specified + 1 The caller is now the primary owner of + the name, replacing any previous owner. Either the name had no + owner before, or the caller specified + DBUS_NAME_FLAG_REPLACE_EXISTING and the current owner specified DBUS_NAME_FLAG_ALLOW_REPLACEMENT. - - - DBUS_REQUEST_NAME_REPLY_IN_QUEUE - 2 + + + DBUS_REQUEST_NAME_REPLY_IN_QUEUE + 2 - The name already had an owner, + The name already had an owner, DBUS_NAME_FLAG_DO_NOT_QUEUE was not specified, and either the current owner did not specify DBUS_NAME_FLAG_ALLOW_REPLACEMENT or the requesting application did not specify DBUS_NAME_FLAG_REPLACE_EXISTING. - - - DBUS_REQUEST_NAME_REPLY_EXISTS 3 - The name already has an owner, - DBUS_NAME_FLAG_DO_NOT_QUEUE was specified, and either - DBUS_NAME_FLAG_ALLOW_REPLACEMENT was not specified by the - current owner, or DBUS_NAME_FLAG_REPLACE_EXISTING was not - specified by the requesting application. - - - DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER - 4 - The application trying to request ownership of a name is already the owner of it. - - - - + + + DBUS_REQUEST_NAME_REPLY_EXISTS 3 + The name already has an owner, + DBUS_NAME_FLAG_DO_NOT_QUEUE was specified, and either + DBUS_NAME_FLAG_ALLOW_REPLACEMENT was not specified by the + current owner, or DBUS_NAME_FLAG_REPLACE_EXISTING was not + specified by the requesting application. + + + DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER + 4 + The application trying to request ownership of a name is already the owner of it. + + + + @@ -4302,7 +4302,7 @@ - + DBUS_RELEASE_NAME_REPLY_RELEASED 1 The caller has released his claim on the given name. Either the caller was the primary owner of @@ -4310,21 +4310,21 @@ waiting in the queue for the name, or the caller was waiting in the queue for the name and has now been removed from the queue. - - - DBUS_RELEASE_NAME_REPLY_NON_EXISTENT - 2 - The given name does not exist on this bus. - - - DBUS_RELEASE_NAME_REPLY_NOT_OWNER - 3 - The caller was not the primary owner of this name, + + + DBUS_RELEASE_NAME_REPLY_NON_EXISTENT + 2 + The given name does not exist on this bus. + + + DBUS_RELEASE_NAME_REPLY_NOT_OWNER + 3 + The caller was not the primary owner of this name, and was also not waiting in the queue to own this name. - - - - + + + +
@@ -4486,7 +4486,7 @@ Match Rules - An important part of the message bus routing protocol is match + An important part of the message bus routing protocol is match rules. Match rules describe the messages that should be sent to a client, based on the contents of the message. Broadcast signals are only sent to clients which have a suitable match rule: this @@ -4773,14 +4773,14 @@ and Exec (the command to be executed).
- Example service description file - + Example service description file + # Sample service description file [D-BUS Service] Name=com.example.ConfigurationDatabase Exec=/usr/bin/sample-configd -
+
@@ -5362,16 +5362,16 @@ STRING Name with a new owner - - 1 - STRING - Old owner or empty string if none - - - 2 - STRING - New owner or empty string if none - + + 1 + STRING + Old owner or empty string if none + + + 2 + STRING + New owner or empty string if none + @@ -5471,11 +5471,11 @@ STRING Name of the service to start - - 1 - UINT32 - Flags (currently not used) - + + 1 + UINT32 + Flags (currently not used) + @@ -5513,7 +5513,7 @@ - + DBUS_START_REPLY_SUCCESS 1 The service was successfully started. @@ -5970,8 +5970,8 @@ Adds a match rule to match messages going through the message bus (see ). - If the bus does not have enough resources the org.freedesktop.DBus.Error.OOM - error is returned. + If the bus does not have enough resources the org.freedesktop.DBus.Error.OOM + error is returned.
@@ -6001,8 +6001,8 @@ Removes the first rule that matches (see ). - If the rule is not found the org.freedesktop.DBus.Error.MatchRuleNotFound - error is returned. + If the rule is not found the org.freedesktop.DBus.Error.MatchRuleNotFound + error is returned. @@ -6146,7 +6146,7 @@ One-to-One - + An application talking directly to another application, without going through a message bus. One-to-one connections may be "peer to peer" or "client to server." The D-Bus protocol has no concept of client @@ -6186,7 +6186,7 @@ Services normally guarantee some particular features, for example they may guarantee that they will request a specific name such as "com.example.Screensaver", have a singleton object - "/com/example/Application", and that object will implement the + "/com/example/Application", and that object will implement the interface "com.example.Screensaver.Control". -- cgit v1.2.3 From 7628af5924dc4359e8f1334070310aabf3901ada Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Tue, 10 Dec 2013 10:02:27 +0800 Subject: DBus Spec: add document of bind for tcp/nonce-tcp transport tcp/nonce-tcp transport has a "bind" key, which can be specified a hostname and will override hostname specified in "host" key. "bind" has a special value "*" which means ip address 0.0.0.0 and will cause dbus-daemon listen on all interfaces. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72301 Reviewed-by: Simon McVittie --- doc/dbus-specification.xml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index 5043849f..f1495559 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -3180,7 +3180,18 @@ host (string) - dns name or ip address + DNS name or IP address + + + bind + (string) + Used in a listenable address to configure the interface + on which the server will listen: either the IP address of one of + the local machine's interfaces (most commonly 127.0.0.1 + ), or a DNS name that resolves to one of those IP + addresses, or '*' to listen on all interfaces simultaneously. + If not specified, the default is the same value as "host". + port @@ -3256,7 +3267,13 @@ host (string) - dns name or ip address + DNS name or IP address + + + bind + (string) + The same as for tcp: addresses + port -- cgit v1.2.3 From a77f64d5e1b411b14a6768d63a2c677ae064a256 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Tue, 10 Dec 2013 10:06:23 +0800 Subject: dbus-daemon(1): align document about "bind" with DBus Spec Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72301 Reviewed-by: Simon McVittie --- doc/dbus-daemon.1.xml.in | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/dbus-daemon.1.xml.in b/doc/dbus-daemon.1.xml.in index 1a1e42cd..7b7f4a1b 100644 --- a/doc/dbus-daemon.1.xml.in +++ b/doc/dbus-daemon.1.xml.in @@ -392,12 +392,13 @@ DBUS_SESSION_BUS_ADDRESS is set. Example: <listen>tcp:host=localhost,port=0</listen> -tcp addresses also allow a bind=hostname option, which will override -the host option specifying what address to bind to, without changing -the address reported by the bus. The bind option can also take a -special name '*' to cause the bus to listen on all local address -(INADDR_ANY). The specified host should be a valid name of the local -machine or weird stuff will happen. +tcp/nonce-tcp addresses also allow a bind=hostname option, +used in a listenable address to configure the interface on which +the server will listen: either the hostname is the IP address of +one of the local machine's interfaces (most commonly 127.0.0.1), +or a DNS name that resolves to one of those IP addresses, or '*' +to listen on all interfaces simultaneously. If not specified, +the default is the same value as "host". Example: <listen>tcp:host=localhost,bind=*,port=0</listen> -- cgit v1.2.3 From 5cef4cbf5ae059443df4215887242ca07167669a Mon Sep 17 00:00:00 2001 From: Matt Fischer Date: Fri, 8 Nov 2013 16:08:39 -0600 Subject: Define WIN32_LEAN_AND_MEAN in Windows port somewhat cloyingly attempts to include by default, which causes problems if the rest of the program is trying to use the incompatible . The Windows sysdep header attempts to prevent this by forcibly defining the winsock header guard macro, so that it will not be included. However, this does not work on MinGW because it uses a different guard macro name. This patch changes the code to instead define WIN32_LEAN_AND_MEAN, which is a more portable way to ensure that will not be included. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71405 Reviewed-By: Ralf Habacker --- dbus/dbus-sysdeps-win.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbus/dbus-sysdeps-win.h b/dbus/dbus-sysdeps-win.h index 90d14de0..02e7a83f 100644 --- a/dbus/dbus-sysdeps-win.h +++ b/dbus/dbus-sysdeps-win.h @@ -27,7 +27,7 @@ #define DBUS_SYSDEPS_WIN_H extern void *_dbus_win_get_dll_hmodule (void); -#define _WINSOCKAPI_ +#define WIN32_LEAN_AND_MEAN #include "dbus-hash.h" #include "dbus-string.h" -- cgit v1.2.3 From ee4f946d0506a3c00fa9d5f2e3c947d48e9c4ea6 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Wed, 20 Nov 2013 11:30:59 +0800 Subject: Do not install systemd unit files if build without systemd If dbus buid without systemd (--disable-systemd or no systemd libs available when building), we expect not to install dbus systemd unit files because they're only for systemd environment. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71818 Reviewed-by: Simon McVittie --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e37a6329..b18c30f6 100644 --- a/configure.ac +++ b/configure.ac @@ -1497,7 +1497,7 @@ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service if test "x$with_systemdsystemunitdir" != xno; then AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) fi -AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) +AM_CONDITIONAL(HAVE_SYSTEMD, [test "x$have_systemd" != "xno" -a -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) ##### Set up location for system bus socket if ! test -z "$with_system_socket"; then -- cgit v1.2.3 From 127ef144f34fcc89a6f113c23bc7c9f06811c9f0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 6 Jan 2014 18:40:26 +0000 Subject: 1.7.10 --- NEWS | 45 ++++++++++++++++++++++++++++++++++++++++++--- configure.ac | 2 +- doc/dbus-specification.xml | 10 ++++++---- 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 3cc46d2a..a1dc4568 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,29 @@ -D-Bus 1.7.10 (UNRELEASED) +D-Bus 1.7.10 (2014-01-06) == +The “weighted companion cube” release. + +This is a release candidate for D-Bus 1.8. + D-Bus Specification 0.23: • don't require messages with no INTERFACE to be dispatched (fd.o #68597, Simon McVittie) +• document "tcp:bind=..." and "nonce-tcp:bind=..." (fd.o #72301, + Chengwei Yang) + +• define "listenable" and "connectable" addresses, and discuss + the difference (fd.o #61303, Simon McVittie) + +Enhancements: + +• support printing Unix file descriptors in dbus-send, dbus-monitor + (fd.o #70592, Robert Ancell) + +• don't install systemd units if --disable-systemd is given + (fd.o #71818, Chengwei Yang) + Fixes: • don't leak memory on out-of-memory while listing activatable or @@ -22,8 +40,29 @@ Fixes: • define PROCESS_QUERY_LIMITED_INFORMATION if missing from MinGW < 4 headers (fd.o #71366, Matt Fischer) -• support printing Unix file descriptors in dbus-send, dbus-monitor - (fd.o #70592, Robert Ancell) +• define WIN32_LEAN_AND_MEAN to avoid conflicts between winsock.h and + winsock2.h (fd.o #71405, Matt Fischer) + +• do not return failure from _dbus_read_nonce() with no error set, + preventing a potential crash (fd.o #72298, Chengwei Yang) + +• on BSD systems, avoid some O(1)-per-process memory and fd leaks in kqueue, + preventing test failures (fd.o #69332, fd.o #72213; Chengwei Yang) + +• fix warning spam on Hurd by not trying to set SO_REUSEADDR on Unix sockets, + which doesn't do anything anyway on at least Linux and FreeBSD + (fd.o #69492, Simon McVittie) + +• fix use of TCP sockets on FreeBSD and Hurd by tolerating EINVAL from + sendmsg() with SCM_CREDS (retrying with plain send()), and looking + for credentials more correctly (fd.o #69492, Simon McVittie) + +• ensure that tests run with a temporary XDG_RUNTIME_DIR to avoid + getting mixed up in XDG/systemd "user sessions" (fd.o #61301, + Simon McVittie) + +• refresh cached policy rules for existing connections when bus + configuration changes (fd.o #39463, Chengwei Yang) D-Bus 1.7.8 (2013-11-01) == diff --git a/configure.ac b/configure.ac index b18c30f6..7d01653c 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.63]) m4_define([dbus_major_version], [1]) m4_define([dbus_minor_version], [7]) -m4_define([dbus_micro_version], [9]) +m4_define([dbus_micro_version], [10]) m4_define([dbus_version], [dbus_major_version.dbus_minor_version.dbus_micro_version]) AC_INIT([dbus],[dbus_version],[https://bugs.freedesktop.org/enter_bug.cgi?product=dbus],[dbus]) diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index f1495559..8b83495f 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -7,7 +7,7 @@ D-Bus Specification Version 0.23 - (not yet released) + 2014-01-06 Havoc @@ -73,10 +73,12 @@ 0.23 - not yet released - + 2014-01-06 + SMcV, CY - see commit log + method call messages with no INTERFACE may be considered an error; + document tcp:bind=... and nonce-tcp:bind=...; define listenable + and connectable addresses -- cgit v1.2.3