summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2014-10-01 19:45:45 +0100
committerSimon McVittie <smcv@debian.org>2014-10-01 19:45:45 +0100
commit04fa4a0e894e2600e401c59015888fd6582483b1 (patch)
tree0995a22a5600cbbda71ee588dbc911995002a539
parent326d7d955f07acb373791720ca4dea52be378f45 (diff)
parent255f62947424c4622609eb93ed53371dda28aac9 (diff)
downloaddbus-04fa4a0e894e2600e401c59015888fd6582483b1.tar.gz
Merge tag 'upstream/1.9.0' into experimental
Upstream version 1.9.0 Conflicts: Makefile.in NEWS bus/Makefile.in config.sub configure configure.ac test/Makefile.in
-rw-r--r--Makefile.in4
-rw-r--r--NEWS87
-rw-r--r--bus/Makefile.am29
-rw-r--r--bus/Makefile.in103
-rw-r--r--bus/activation.c8
-rw-r--r--bus/dir-watch-inotify.c6
-rw-r--r--bus/dir-watch-kqueue.c17
-rw-r--r--bus/dispatch.c164
-rw-r--r--bus/driver.c1
-rw-r--r--bus/example-session-disable-stats.conf.in15
-rw-r--r--bus/example-system-enable-stats.conf.in15
-rw-r--r--bus/signals.c184
-rw-r--r--bus/signals.h6
-rw-r--r--bus/stats.c117
-rw-r--r--bus/stats.h5
-rw-r--r--bus/system.conf.in15
-rw-r--r--cmake/CMakeLists.txt14
-rw-r--r--cmake/bus/CMakeLists.txt39
-rw-r--r--cmake/dbus/CMakeLists.txt18
-rw-r--r--cmake/doc/CMakeLists.txt15
-rw-r--r--cmake/modules/MacrosAutotools.cmake7
-rw-r--r--cmake/test/CMakeLists.txt7
-rw-r--r--cmake/tools/CMakeLists.txt3
-rw-r--r--config.h.in7
-rwxr-xr-xconfig.sub9
-rwxr-xr-xconfigure107
-rw-r--r--configure.ac29
-rw-r--r--dbus/Makefile.am13
-rw-r--r--dbus/Makefile.in62
-rw-r--r--dbus/dbus-errors.c4
-rw-r--r--dbus/dbus-hash.c6
-rw-r--r--dbus/dbus-marshal-basic.c6
-rw-r--r--dbus/dbus-message-util.c16
-rw-r--r--dbus/dbus-message.c2
-rw-r--r--dbus/dbus-server-launchd.c1
-rw-r--r--dbus/dbus-signature.c2
-rw-r--r--dbus/dbus-string.c23
-rw-r--r--dbus/dbus-string.h3
-rw-r--r--dbus/dbus-sysdeps-unix.c68
-rw-r--r--dbus/dbus-sysdeps-unix.h2
-rw-r--r--dbus/dbus-sysdeps-util-unix.c4
-rw-r--r--dbus/dbus-sysdeps-util-win.c275
-rw-r--r--dbus/dbus-sysdeps-win.c11
-rw-r--r--dbus/dbus-sysdeps.h2
-rw-r--r--dbus/sd-daemon.c520
-rw-r--r--dbus/sd-daemon.h282
-rw-r--r--doc/dbus-launch.1.xml.in2
-rw-r--r--doc/dbus-specification.xml73
-rw-r--r--doc/dbus-tutorial.xml2
-rw-r--r--test/Makefile.am7
-rw-r--r--test/Makefile.in56
-rw-r--r--test/manual-dir-iter.c92
-rw-r--r--tools/dbus-print-message.c166
53 files changed, 1456 insertions, 1275 deletions
diff --git a/Makefile.in b/Makefile.in
index dfdc6194..8cb80061 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -123,8 +123,8 @@ DIST_COMMON = $(srcdir)/tools/lcov.am INSTALL NEWS README AUTHORS \
$(top_srcdir)/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service.in \
$(top_srcdir)/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service.in \
$(top_srcdir)/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in \
- COPYING compile config.guess config.sub depcomp install-sh \
- missing ltmain.sh
+ COPYING compile config.guess config.sub install-sh missing \
+ ltmain.sh
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
diff --git a/NEWS b/NEWS
index b10ab4f7..271a3b7c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,90 @@
+D-Bus 1.9.0 (2014-10-01)
+==
+
+The “tiered cheeses” release.
+
+Requirements:
+
+• Support for the systemd: (LISTEN_FDS) pseudo-transport on Linux now
+ requires either the libsystemd or libsd-daemon shared library, dropping the
+ embedded convenience copy of sd-daemon (fd.o #71818, Simon)
+
+Build-time configuration changes:
+
+• The Stats interface is now enabled by default, and locked-down to
+ root-only on the system bus. Configure with --disable-stats
+ to disable it altogether on memory- or disk-constrained systems,
+ or see ${docdir}/examples/ to open it up to non-root users on the
+ system bus or restrict access on the session bus.
+ (fd.o #80759; Simon McVittie, Alban Crequy)
+
+• The CMake build system now builds the same shared library name as Autotools
+ on at least Linux and Windows:
+ - on Linux (and perhaps other Unix platforms), it previously built
+ libdbus-1.so, but now builds libdbus-1.so.3.* with development
+ symlink libdbus-1.so and SONAME/symlink libdbus-1.so.3
+ - on Windows, it previously built either libdbus-1.dll (release) or
+ libdbus-1d.dll (debug), but now builds libdbus-1-3.dll, copied to
+ libdbus-1.dll for compatibility with older applications.
+ (fd.o #74117, Ralf Habacker)
+
+Enhancements:
+
+• D-Bus Specification version 0.24
+ · document how to quote match rules (fd.o #24307, Simon McVittie)
+ · explicitly say that most message types never expect a reply
+ regardles of whether they have NO_REPLY_EXPECTED
+ (fd.o #75749, Simon McVittie)
+
+• on Unix platforms, disable Nagle's algorithm on TCP connections to improve
+ initial latency (fd.o #75544, Matt Hoosier)
+
+• use backtrace() if it is in -lexecinfo instead of libc, as on NetBSD
+ (fd.o #69702, Patrick Welche)
+
+• in dbus-monitor, print more information about file descriptors
+ (fd.o #80603, Alban Crequy)
+
+• do not install system bus configuration if built for Windows
+ (fd.o #83583; Ralf Habacker, Simon McVittie)
+
+• Add GetAllMatchRules to the Stats interface (fd.o #24307, Alban Crequy)
+
+• Add a regression test for file descriptor passing (fd.o #83622,
+ Simon McVittie)
+
+Fixes:
+
+• fix an incorrect error message if a Unix socket path is too long
+ (fd.o #73887, Antoine Jacoutot)
+
+• in an MSYS/Cygwin environment, pass Unix-style filenames to xmlto,
+ fixing documentation generation (fd.o #75860, Руслан Ижбулатов)
+
+• in Unix with X11, avoid giving dbus-launch a misleading argv[0]
+ in ps(1) (fd.o #69716, Chengwei Yang)
+
+• avoid calling poll() with timeout < -1, which is considered invalid
+ on FreeBSD and NetBSD (fd.o #78480, Jaap Boender)
+
+• be portable to BSD-derived platforms where O_CLOEXEC is unavailable in libc
+ (like Mac OS X 10.6), or available in libc but unsupported by the kernel
+ (fd.o #77032; rmvsxop, OBATA Akio, Patrick Welche)
+
+• Fix include path for test/internal/*.c with cmake (Ralf Habacker)
+
+• Documentation improvements
+ (fd.o #80795, #84313; Thomas Haller, Sebastian Rasmussen)
+
+• in dbus-monitor, do not leak file descriptors that we have monitored
+ (fd.o #80603, Alban Crequy)
+
+• Set the close-on-exec flag for the inotify file descriptor, even
+ if built with CMake or older libc (fd.o #73689, Simon McVittie)
+
+• Remove some LGPL code from the Windows dbus-daemon
+ (fd.o #57272, Ralf Habacker)
+
D-Bus 1.8.8 (2014-09-16)
==
diff --git a/bus/Makefile.am b/bus/Makefile.am
index f335e30c..c0bc1549 100644
--- a/bus/Makefile.am
+++ b/bus/Makefile.am
@@ -31,11 +31,22 @@ EFENCE=
CONFIG_IN_FILES= \
session.conf.in \
system.conf.in \
- org.freedesktop.dbus-session.plist.in
+ org.freedesktop.dbus-session.plist.in \
+ example-system-enable-stats.conf.in \
+ example-session-disable-stats.conf.in \
+ $(NULL)
+
+config_DATA = session.conf
+
+if DBUS_UNIX
+config_DATA += system.conf
+endif
-config_DATA= \
- session.conf \
- system.conf
+examplesdir = ${docdir}/examples
+examples_DATA = \
+ example-system-enable-stats.conf \
+ example-session-disable-stats.conf \
+ $(NULL)
if DBUS_ENABLE_LAUNCHD
agentdir=$(LAUNCHD_AGENT_DIR)
@@ -169,11 +180,11 @@ if DBUS_ENABLE_EMBEDDED_TESTS
## even when not doing "make check"
# run as a test by test/Makefile.am
-noinst_PROGRAMS += test-bus test-bus-system
+noinst_PROGRAMS += test-bus
if DBUS_UNIX
# run as a test by test/Makefile.am
-noinst_PROGRAMS += test-bus-launch-helper
+noinst_PROGRAMS += test-bus-launch-helper test-bus-system
# this is used by the tests but is not,itself, a test
noinst_PROGRAMS += dbus-daemon-launch-helper-test
endif DBUS_UNIX
@@ -203,11 +214,13 @@ clean-local:
/bin/rm *.bb *.bbg *.da *.gcov || true
install-data-hook:
- $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
- $(mkinstalldirs) $(DESTDIR)$(configdir)/system.d
$(mkinstalldirs) $(DESTDIR)$(configdir)/session.d
$(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/services
+if DBUS_UNIX
+ $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
+ $(mkinstalldirs) $(DESTDIR)$(configdir)/system.d
$(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/system-services
+endif
if HAVE_SYSTEMD
# Install dbus.socket as default implementation of a D-Bus stack.
# Deliberately not using $(LN_S) here: ln -fs is not universally portable,
diff --git a/bus/Makefile.in b/bus/Makefile.in
index 4425b030..0f409cd4 100644
--- a/bus/Makefile.in
+++ b/bus/Makefile.in
@@ -80,24 +80,28 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+@DBUS_UNIX_TRUE@am__append_1 = system.conf
noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2)
dbus_daemon_exec_PROGRAMS = dbus-daemon$(EXEEXT)
@DBUS_UNIX_TRUE@libexec_PROGRAMS = dbus-daemon-launch-helper$(EXEEXT)
# run as a test by test/Makefile.am
-@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@am__append_1 = test-bus test-bus-system
+@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@am__append_2 = test-bus
# run as a test by test/Makefile.am
# this is used by the tests but is not,itself, a test
-@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@am__append_2 = test-bus-launch-helper \
+@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@am__append_3 = test-bus-launch-helper \
+@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@ test-bus-system \
@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@ dbus-daemon-launch-helper-test
-@HAVE_SYSTEMD_TRUE@am__append_3 = \
+@HAVE_SYSTEMD_TRUE@am__append_4 = \
@HAVE_SYSTEMD_TRUE@ dbus.service.in \
@HAVE_SYSTEMD_TRUE@ dbus.socket.in
subdir = bus
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/system.conf.in $(srcdir)/session.conf.in \
+ $(srcdir)/example-system-enable-stats.conf.in \
+ $(srcdir)/example-session-disable-stats.conf.in \
$(srcdir)/messagebus.in $(srcdir)/messagebus-config.in \
$(srcdir)/org.freedesktop.dbus-session.plist.in \
$(srcdir)/rc.messagebus.in $(srcdir)/dbus.service.in \
@@ -114,17 +118,20 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = system.conf session.conf messagebus \
+CONFIG_CLEAN_FILES = system.conf session.conf \
+ example-system-enable-stats.conf \
+ example-session-disable-stats.conf messagebus \
messagebus-config org.freedesktop.dbus-session.plist \
rc.messagebus dbus.service dbus.socket
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(dbus_daemon_execdir)" \
"$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(initddir)" "$(DESTDIR)$(agentdir)" \
- "$(DESTDIR)$(configdir)" "$(DESTDIR)$(systemdsystemunitdir)"
-@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@am__EXEEXT_1 = test-bus$(EXEEXT) \
-@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@ test-bus-system$(EXEEXT)
+ "$(DESTDIR)$(configdir)" "$(DESTDIR)$(examplesdir)" \
+ "$(DESTDIR)$(systemdsystemunitdir)"
+@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@am__EXEEXT_1 = test-bus$(EXEEXT)
@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@am__EXEEXT_2 = test-bus-launch-helper$(EXEEXT) \
+@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@ test-bus-system$(EXEEXT) \
@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@ dbus-daemon-launch-helper-test$(EXEEXT)
PROGRAMS = $(dbus_daemon_exec_PROGRAMS) $(libexec_PROGRAMS) \
$(noinst_PROGRAMS)
@@ -295,7 +302,8 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
-DATA = $(agent_DATA) $(config_DATA) $(systemdsystemunit_DATA)
+DATA = $(agent_DATA) $(config_DATA) $(examples_DATA) \
+ $(systemdsystemunit_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
@@ -551,11 +559,17 @@ EFENCE =
CONFIG_IN_FILES = \
session.conf.in \
system.conf.in \
- org.freedesktop.dbus-session.plist.in
+ org.freedesktop.dbus-session.plist.in \
+ example-system-enable-stats.conf.in \
+ example-session-disable-stats.conf.in \
+ $(NULL)
-config_DATA = \
- session.conf \
- system.conf
+config_DATA = session.conf $(am__append_1)
+examplesdir = ${docdir}/examples
+examples_DATA = \
+ example-system-enable-stats.conf \
+ example-session-disable-stats.conf \
+ $(NULL)
@DBUS_ENABLE_LAUNCHD_TRUE@agentdir = $(LAUNCHD_AGENT_DIR)
@DBUS_ENABLE_LAUNCHD_TRUE@agent_DATA = org.freedesktop.dbus-session.plist
@@ -676,7 +690,7 @@ test_bus_LDADD = $(top_builddir)/dbus/libdbus-internal.la $(DBUS_BUS_LIBS)
#### Init scripts fun
SCRIPT_IN_FILES = messagebus.in messagebus-config.in rc.messagebus.in \
- $(am__append_3)
+ $(am__append_4)
@DBUS_INIT_SCRIPTS_RED_HAT_TRUE@initddir = $(sysconfdir)/rc.d/init.d
@DBUS_INIT_SCRIPTS_SLACKWARE_TRUE@initddir = $(sysconfdir)/rc.d/
@DBUS_INIT_SCRIPTS_RED_HAT_TRUE@initd_SCRIPTS = \
@@ -733,6 +747,10 @@ system.conf: $(top_builddir)/config.status $(srcdir)/system.conf.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
session.conf: $(top_builddir)/config.status $(srcdir)/session.conf.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+example-system-enable-stats.conf: $(top_builddir)/config.status $(srcdir)/example-system-enable-stats.conf.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+example-session-disable-stats.conf: $(top_builddir)/config.status $(srcdir)/example-session-disable-stats.conf.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
messagebus: $(top_builddir)/config.status $(srcdir)/messagebus.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
messagebus-config: $(top_builddir)/config.status $(srcdir)/messagebus-config.in
@@ -1258,6 +1276,27 @@ uninstall-configDATA:
@list='$(config_DATA)'; test -n "$(configdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(configdir)'; $(am__uninstall_files_from_dir)
+install-examplesDATA: $(examples_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(examples_DATA)'; test -n "$(examplesdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(examplesdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(examplesdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(examplesdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(examplesdir)" || exit $$?; \
+ done
+
+uninstall-examplesDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(examples_DATA)'; test -n "$(examplesdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(examplesdir)'; $(am__uninstall_files_from_dir)
install-systemdsystemunitDATA: $(systemdsystemunit_DATA)
@$(NORMAL_INSTALL)
@list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
@@ -1366,7 +1405,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA)
installdirs:
- for dir in "$(DESTDIR)$(dbus_daemon_execdir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(initddir)" "$(DESTDIR)$(agentdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(systemdsystemunitdir)"; do \
+ for dir in "$(DESTDIR)$(dbus_daemon_execdir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(initddir)" "$(DESTDIR)$(agentdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(examplesdir)" "$(DESTDIR)$(systemdsystemunitdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -1425,7 +1464,8 @@ info: info-am
info-am:
install-data-am: install-agentDATA install-configDATA \
- install-initdSCRIPTS install-systemdsystemunitDATA
+ install-examplesDATA install-initdSCRIPTS \
+ install-systemdsystemunitDATA
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am
@@ -1476,8 +1516,8 @@ ps-am:
uninstall-am: uninstall-agentDATA uninstall-binSCRIPTS \
uninstall-configDATA uninstall-dbus_daemon_execPROGRAMS \
- uninstall-initdSCRIPTS uninstall-libexecPROGRAMS \
- uninstall-systemdsystemunitDATA
+ uninstall-examplesDATA uninstall-initdSCRIPTS \
+ uninstall-libexecPROGRAMS uninstall-systemdsystemunitDATA
.MAKE: install-am install-data-am install-exec-am install-strip
@@ -1490,17 +1530,18 @@ uninstall-am: uninstall-agentDATA uninstall-binSCRIPTS \
install install-agentDATA install-am install-binSCRIPTS \
install-configDATA install-data install-data-am \
install-data-hook install-dbus_daemon_execPROGRAMS install-dvi \
- install-dvi-am install-exec install-exec-am install-exec-hook \
- install-html install-html-am install-info install-info-am \
- install-initdSCRIPTS install-libexecPROGRAMS install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip install-systemdsystemunitDATA installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags tags-am uninstall uninstall-agentDATA uninstall-am \
- uninstall-binSCRIPTS uninstall-configDATA \
- uninstall-dbus_daemon_execPROGRAMS uninstall-initdSCRIPTS \
+ install-dvi-am install-examplesDATA install-exec \
+ install-exec-am install-exec-hook install-html install-html-am \
+ install-info install-info-am install-initdSCRIPTS \
+ install-libexecPROGRAMS install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip \
+ install-systemdsystemunitDATA installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-agentDATA uninstall-am uninstall-binSCRIPTS \
+ uninstall-configDATA uninstall-dbus_daemon_execPROGRAMS \
+ uninstall-examplesDATA uninstall-initdSCRIPTS \
uninstall-libexecPROGRAMS uninstall-systemdsystemunitDATA
@@ -1508,11 +1549,11 @@ clean-local:
/bin/rm *.bb *.bbg *.da *.gcov || true
install-data-hook:
- $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
- $(mkinstalldirs) $(DESTDIR)$(configdir)/system.d
$(mkinstalldirs) $(DESTDIR)$(configdir)/session.d
$(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/services
- $(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/system-services
+@DBUS_UNIX_TRUE@ $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
+@DBUS_UNIX_TRUE@ $(mkinstalldirs) $(DESTDIR)$(configdir)/system.d
+@DBUS_UNIX_TRUE@ $(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/system-services
# Install dbus.socket as default implementation of a D-Bus stack.
# Deliberately not using $(LN_S) here: ln -fs is not universally portable,
# but neither is systemd, so it's OK to assume here that ln complies with SUS.
diff --git a/bus/activation.c b/bus/activation.c
index 149cca8a..bdf9cf3d 100644
--- a/bus/activation.c
+++ b/bus/activation.c
@@ -637,7 +637,7 @@ update_directory (BusActivation *activation,
if (!_dbus_string_ends_with_c_str (&filename, ".service"))
{
- _dbus_verbose ("Skipping non-.service file %s\n",
+ _dbus_verbose ("Skipping non-.service file '%s'\n",
_dbus_string_get_const_data (&filename));
continue;
}
@@ -1044,7 +1044,7 @@ restore_pending (void *data)
}
static void
-free_pending_restore_data (void *data)
+free_restore_pending_data (void *data)
{
RestorePendingData *d = data;
@@ -1074,9 +1074,9 @@ add_restore_pending_to_transaction (BusTransaction *transaction,
if (d->hash_entry == NULL ||
!bus_transaction_add_cancel_hook (transaction, restore_pending, d,
- free_pending_restore_data))
+ free_restore_pending_data))
{
- free_pending_restore_data (d);
+ free_restore_pending_data (d);
return FALSE;
}
diff --git a/bus/dir-watch-inotify.c b/bus/dir-watch-inotify.c
index 49ebc721..ce19fdc8 100644
--- a/bus/dir-watch-inotify.c
+++ b/bus/dir-watch-inotify.c
@@ -38,6 +38,7 @@
#include <dbus/dbus-internals.h>
#include <dbus/dbus-list.h>
+#include <dbus/dbus-sysdeps-unix.h>
#include <dbus/dbus-watch.h>
#include "dir-watch.h"
@@ -236,6 +237,11 @@ _init_inotify (BusContext *context)
_dbus_warn ("Cannot initialize inotify\n");
goto out;
}
+
+ /* In the inotify_init1 case this is unnecessary but harmless,
+ * in the other cases it's necessary */
+ _dbus_fd_set_close_on_exec (inotify_fd);
+
loop = bus_context_get_loop (context);
_dbus_loop_ref (loop);
diff --git a/bus/dir-watch-kqueue.c b/bus/dir-watch-kqueue.c
index 33d5e95d..c05a5997 100644
--- a/bus/dir-watch-kqueue.c
+++ b/bus/dir-watch-kqueue.c
@@ -202,6 +202,9 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories)
DBusList *link;
int i, j, fd;
struct kevent ev;
+#ifdef O_CLOEXEC
+ dbus_bool_t cloexec_done = 0;
+#endif
if (!_init_kqueue (context))
goto out;
@@ -259,7 +262,15 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories)
/* FIXME - less lame error handling for failing to add a watch;
* we may need to sleep.
*/
+#ifdef O_CLOEXEC
fd = open (new_dirs[i], O_RDONLY | O_CLOEXEC);
+ cloexec_done = (fd >= 0);
+
+ if (fd < 0 && errno == EINVAL)
+#endif
+ {
+ fd = open (new_dirs[i], O_RDONLY);
+ }
if (fd < 0)
{
if (errno != ENOENT)
@@ -274,6 +285,12 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories)
continue;
}
}
+#ifdef O_CLOEXEC
+ if (!cloexec_done)
+#endif
+ {
+ _dbus_fd_set_close_on_exec (fd);
+ }
EV_SET (&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_RENAME, 0, 0);
diff --git a/bus/dispatch.c b/bus/dispatch.c
index 7a61953f..fa2cc968 100644
--- a/bus/dispatch.c
+++ b/bus/dispatch.c
@@ -433,6 +433,8 @@ bus_dispatch_remove_connection (DBusConnection *connection)
#include <stdio.h>
+#include "stats.h"
+
/* This is used to know whether we need to block in order to finish
* sending a message, or whether the initial dbus_connection_send()
* already flushed the queue.
@@ -1393,20 +1395,21 @@ check_get_connection_unix_process_id (BusContext *context,
* but the correct thing may include OOM errors.
*/
static dbus_bool_t
-check_add_match_all (BusContext *context,
- DBusConnection *connection)
+check_add_match (BusContext *context,
+ DBusConnection *connection,
+ const char *rule)
{
DBusMessage *message;
dbus_bool_t retval;
dbus_uint32_t serial;
DBusError error;
- const char *empty = "";
retval = FALSE;
dbus_error_init (&error);
message = NULL;
- _dbus_verbose ("check_add_match_all for %p\n", connection);
+ _dbus_verbose ("check_add_match for connection %p, rule %s\n",
+ connection, rule);
message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
@@ -1416,8 +1419,7 @@ check_add_match_all (BusContext *context,
if (message == NULL)
return TRUE;
- /* empty string match rule matches everything */
- if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &empty,
+ if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &rule,
DBUS_TYPE_INVALID))
{
dbus_message_unref (message);
@@ -1521,6 +1523,132 @@ check_add_match_all (BusContext *context,
return retval;
}
+#ifdef DBUS_ENABLE_STATS
+/* returns TRUE if the correct thing happens,
+ * but the correct thing may include OOM errors.
+ */
+static dbus_bool_t
+check_get_all_match_rules (BusContext *context,
+ DBusConnection *connection)
+{
+ DBusMessage *message;
+ dbus_bool_t retval;
+ dbus_uint32_t serial;
+ DBusError error;
+
+ retval = FALSE;
+ dbus_error_init (&error);
+ message = NULL;
+
+ _dbus_verbose ("check_get_all_match_rules for connection %p\n",
+ connection);
+
+ message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ BUS_INTERFACE_STATS,
+ "GetAllMatchRules");
+
+ if (message == NULL)
+ return TRUE;
+
+ if (!dbus_connection_send (connection, message, &serial))
+ {
+ dbus_message_unref (message);
+ return TRUE;
+ }
+
+ dbus_message_unref (message);
+ message = NULL;
+
+ dbus_connection_ref (connection); /* because we may get disconnected */
+
+ /* send our message */
+ bus_test_run_clients_loop (SEND_PENDING (connection));
+
+ if (!dbus_connection_get_is_connected (connection))
+ {
+ _dbus_verbose ("connection was disconnected\n");
+
+ dbus_connection_unref (connection);
+
+ return TRUE;
+ }
+
+ block_connection_until_message_from_bus (context, connection, "reply to AddMatch");
+
+ if (!dbus_connection_get_is_connected (connection))
+ {
+ _dbus_verbose ("connection was disconnected\n");
+
+ dbus_connection_unref (connection);
+
+ return TRUE;
+ }
+
+ dbus_connection_unref (connection);
+
+ message = pop_message_waiting_for_memory (connection);
+ if (message == NULL)
+ {
+ _dbus_warn ("Did not receive a reply to %s %d on %p\n",
+ "AddMatch", serial, connection);
+ goto out;
+ }
+
+ verbose_message_received (connection, message);
+
+ if (!dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
+ {
+ _dbus_warn ("Message has wrong sender %s\n",
+ dbus_message_get_sender (message) ?
+ dbus_message_get_sender (message) : "(none)");
+ goto out;
+ }
+
+ if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
+ {
+ if (dbus_message_is_error (message,
+ DBUS_ERROR_NO_MEMORY))
+ {
+ ; /* good, this is a valid response */
+ }
+ else
+ {
+ warn_unexpected (connection, message, "not this error");
+
+ goto out;
+ }
+ }
+ else
+ {
+ if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN)
+ {
+ ; /* good, expected */
+ _dbus_assert (dbus_message_get_reply_serial (message) == serial);
+ }
+ else
+ {
+ warn_unexpected (connection, message, "method return for AddMatch");
+
+ goto out;
+ }
+ }
+
+ if (!check_no_leftovers (context))
+ goto out;
+
+ retval = TRUE;
+
+ out:
+ dbus_error_free (&error);
+
+ if (message)
+ dbus_message_unref (message);
+
+ return retval;
+}
+#endif
+
/* returns TRUE if the correct thing happens,
* but the correct thing may include OOM errors.
*/
@@ -1561,7 +1689,7 @@ check_hello_connection (BusContext *context)
}
else
{
- if (!check_add_match_all (context, connection))
+ if (!check_add_match (context, connection, ""))
return FALSE;
kill_client_connection (context, connection);
@@ -4516,7 +4644,7 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
if (!check_double_hello_message (context, foo))
_dbus_assert_not_reached ("double hello message failed");
- if (!check_add_match_all (context, foo))
+ if (!check_add_match (context, foo, ""))
_dbus_assert_not_reached ("AddMatch message failed");
bar = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
@@ -4531,7 +4659,7 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
if (!check_hello_message (context, bar))
_dbus_assert_not_reached ("hello message failed");
- if (!check_add_match_all (context, bar))
+ if (!check_add_match (context, bar, ""))
_dbus_assert_not_reached ("AddMatch message failed");
baz = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
@@ -4546,9 +4674,17 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
if (!check_hello_message (context, baz))
_dbus_assert_not_reached ("hello message failed");
- if (!check_add_match_all (context, baz))
+ if (!check_add_match (context, baz, ""))
_dbus_assert_not_reached ("AddMatch message failed");
+ if (!check_add_match (context, baz, "interface='com.example'"))
+ _dbus_assert_not_reached ("AddMatch message failed");
+
+#ifdef DBUS_ENABLE_STATS
+ if (!check_get_all_match_rules (context, baz))
+ _dbus_assert_not_reached ("GetAllMatchRules message failed");
+#endif
+
#ifdef DBUS_WIN_FIXME
_dbus_warn("TODO: testing of GetConnectionUnixUser message skipped for now\n");
_dbus_warn("TODO: testing of GetConnectionUnixProcessID message skipped for now\n");
@@ -4665,7 +4801,7 @@ bus_dispatch_test_conf_fail (const DBusString *test_data_dir,
if (!check_double_hello_message (context, foo))
_dbus_assert_not_reached ("double hello message failed");
- if (!check_add_match_all (context, foo))
+ if (!check_add_match (context, foo, ""))
_dbus_assert_not_reached ("AddMatch message failed");
/* this only tests the activation.c user check */
@@ -4745,7 +4881,7 @@ bus_dispatch_sha1_test (const DBusString *test_data_dir)
if (!check_hello_message (context, foo))
_dbus_assert_not_reached ("hello message failed");
- if (!check_add_match_all (context, foo))
+ if (!check_add_match (context, foo, ""))
_dbus_assert_not_reached ("addmatch message failed");
if (!check_no_leftovers (context))
@@ -4794,7 +4930,7 @@ bus_unix_fds_passing_test(const DBusString *test_data_dir)
if (!check_hello_message (context, foo))
_dbus_assert_not_reached ("hello message failed");
- if (!check_add_match_all (context, foo))
+ if (!check_add_match (context, foo, ""))
_dbus_assert_not_reached ("AddMatch message failed");
bar = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
@@ -4809,7 +4945,7 @@ bus_unix_fds_passing_test(const DBusString *test_data_dir)
if (!check_hello_message (context, bar))
_dbus_assert_not_reached ("hello message failed");
- if (!check_add_match_all (context, bar))
+ if (!check_add_match (context, bar, ""))
_dbus_assert_not_reached ("AddMatch message failed");
if (!(m = dbus_message_new_signal("/", "a.b.c", "d")))
diff --git a/bus/driver.c b/bus/driver.c
index e95a79d9..777b2f89 100644
--- a/bus/driver.c
+++ b/bus/driver.c
@@ -1789,6 +1789,7 @@ static const MessageHandler introspectable_message_handlers[] = {
static const MessageHandler stats_message_handlers[] = {
{ "GetStats", "", "a{sv}", bus_stats_handle_get_stats },
{ "GetConnectionStats", "s", "a{sv}", bus_stats_handle_get_connection_stats },
+ { "GetAllMatchRules", "", "a{sas}", bus_stats_handle_get_all_match_rules },
{ NULL, NULL, NULL, NULL }
};
#endif
diff --git a/bus/example-session-disable-stats.conf.in b/bus/example-session-disable-stats.conf.in
new file mode 100644
index 00000000..2863ef0f
--- /dev/null
+++ b/bus/example-session-disable-stats.conf.in
@@ -0,0 +1,15 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+ <!-- If the Stats interface was enabled at compile-time, users can use it on
+ the session bus by default. Systems providing isolation of processes
+ with LSMs might want to restrict this. This can be achieved by copying
+ this file in @EXPANDED_SYSCONFDIR@/dbus-1/session.d/ -->
+
+ <policy context="default">
+ <deny send_destination="org.freedesktop.DBus"
+ send_interface="org.freedesktop.DBus.Debug.Stats"/>
+ </policy>
+
+</busconfig>
diff --git a/bus/example-system-enable-stats.conf.in b/bus/example-system-enable-stats.conf.in
new file mode 100644
index 00000000..a85aa835
--- /dev/null
+++ b/bus/example-system-enable-stats.conf.in
@@ -0,0 +1,15 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+ <!-- If the Stats interface was enabled at compile-time, only root may use it.
+ Replace USERNAME and copy this file in @EXPANDED_SYSCONFDIR@/dbus-1/system.d/
+ if you want to enable other privileged users to view statistics and
+ debug info -->
+
+ <policy user="USERNAME">
+ <allow send_destination="org.freedesktop.DBus"
+ send_interface="org.freedesktop.DBus.Debug.Stats"/>
+ </policy>
+
+</busconfig>
diff --git a/bus/signals.c b/bus/signals.c
index 4c500c67..119d8130 100644
--- a/bus/signals.c
+++ b/bus/signals.c
@@ -22,6 +22,9 @@
*/
#include <config.h>
+
+#include <string.h>
+
#include "signals.h"
#include "services.h"
#include "utils.h"
@@ -118,10 +121,46 @@ bus_match_rule_unref (BusMatchRule *rule)
}
}
-#ifdef DBUS_ENABLE_VERBOSE_MODE
-/* Note this function does not do escaping, so it's only
- * good for debug spew at the moment
- */
+#if defined(DBUS_ENABLE_VERBOSE_MODE) || defined(DBUS_ENABLE_STATS)
+static dbus_bool_t
+append_key_and_escaped_value (DBusString *str, const char *token, const char *value)
+{
+ const char *p = value;
+
+ if (!_dbus_string_append_printf (str, "%s='", token))
+ return FALSE;
+
+ while (*p != '\0')
+ {
+ const char *next = strchr (p, '\'');
+
+ if (next)
+ {
+ if (!_dbus_string_append_printf (str, "%.*s", (int) (next - p), p))
+ return FALSE;
+ /* Horrible escape sequence: single quote cannot be escaped inside
+ * a single quoted string. So we close the single quote, escape the
+ * single quote, and reopen a single quote.
+ */
+ if (!_dbus_string_append_printf (str, "'\\''"))
+ return FALSE;
+ p = next + 1;
+ }
+ else
+ {
+ if (!_dbus_string_append_printf (str, "%s", p))
+ return FALSE;
+ break;
+ }
+ }
+
+ if (!_dbus_string_append_byte (str, '\''))
+ return FALSE;
+
+ return TRUE;
+}
+
+/* returns NULL if no memory */
static char*
match_rule_to_string (BusMatchRule *rule)
{
@@ -130,15 +169,12 @@ match_rule_to_string (BusMatchRule *rule)
if (!_dbus_string_init (&str))
{
- char *s;
- while ((s = _dbus_strdup ("nomem")) == NULL)
- ; /* only OK for debug spew... */
- return s;
+ return NULL;
}
if (rule->flags & BUS_MATCH_MESSAGE_TYPE)
{
- if (!_dbus_string_append_printf (&str, "type='%s'",
+ if (!append_key_and_escaped_value (&str, "type",
dbus_message_type_to_string (rule->message_type)))
goto nomem;
}
@@ -151,7 +187,7 @@ match_rule_to_string (BusMatchRule *rule)
goto nomem;
}
- if (!_dbus_string_append_printf (&str, "interface='%s'", rule->interface))
+ if (!append_key_and_escaped_value (&str, "interface", rule->interface))
goto nomem;
}
@@ -163,7 +199,7 @@ match_rule_to_string (BusMatchRule *rule)
goto nomem;
}
- if (!_dbus_string_append_printf (&str, "member='%s'", rule->member))
+ if (!append_key_and_escaped_value (&str, "member", rule->member))
goto nomem;
}
@@ -175,7 +211,7 @@ match_rule_to_string (BusMatchRule *rule)
goto nomem;
}
- if (!_dbus_string_append_printf (&str, "path='%s'", rule->path))
+ if (!append_key_and_escaped_value (&str, "path", rule->path))
goto nomem;
}
@@ -187,7 +223,7 @@ match_rule_to_string (BusMatchRule *rule)
goto nomem;
}
- if (!_dbus_string_append_printf (&str, "path_namespace='%s'", rule->path))
+ if (!append_key_and_escaped_value (&str, "path_namespace", rule->path))
goto nomem;
}
@@ -199,7 +235,7 @@ match_rule_to_string (BusMatchRule *rule)
goto nomem;
}
- if (!_dbus_string_append_printf (&str, "sender='%s'", rule->sender))
+ if (!append_key_and_escaped_value (&str, "sender", rule->sender))
goto nomem;
}
@@ -211,7 +247,7 @@ match_rule_to_string (BusMatchRule *rule)
goto nomem;
}
- if (!_dbus_string_append_printf (&str, "destination='%s'", rule->destination))
+ if (!append_key_and_escaped_value (&str, "destination", rule->destination))
goto nomem;
}
@@ -223,7 +259,7 @@ match_rule_to_string (BusMatchRule *rule)
goto nomem;
}
- if (!_dbus_string_append_printf (&str, "eavesdrop='%s'",
+ if (!append_key_and_escaped_value (&str, "eavesdrop",
(rule->flags & BUS_MATCH_CLIENT_IS_EAVESDROPPING) ?
"true" : "false"))
goto nomem;
@@ -252,11 +288,12 @@ match_rule_to_string (BusMatchRule *rule)
is_namespace = (rule->arg_lens[i] & BUS_MATCH_ARG_NAMESPACE) != 0;
if (!_dbus_string_append_printf (&str,
- "arg%d%s='%s'",
+ "arg%d%s",
i,
is_path ? "path" :
- is_namespace ? "namespace" : "",
- rule->args[i]))
+ is_namespace ? "namespace" : ""))
+ goto nomem;
+ if (!append_key_and_escaped_value (&str, "", rule->args[i]))
goto nomem;
}
@@ -272,14 +309,9 @@ match_rule_to_string (BusMatchRule *rule)
nomem:
_dbus_string_free (&str);
- {
- char *s;
- while ((s = _dbus_strdup ("nomem")) == NULL)
- ; /* only OK for debug spew... */
- return s;
- }
+ return NULL;
}
-#endif /* DBUS_ENABLE_VERBOSE_MODE */
+#endif /* defined(DBUS_ENABLE_VERBOSE_MODE) || defined(DBUS_ENABLE_STATS) */
dbus_bool_t
bus_match_rule_set_message_type (BusMatchRule *rule,
@@ -1141,6 +1173,74 @@ struct BusMatchmaker
RulePool rules_by_type[DBUS_NUM_MESSAGE_TYPES];
};
+#ifdef DBUS_ENABLE_STATS
+dbus_bool_t
+bus_match_rule_dump (BusMatchmaker *matchmaker,
+ DBusConnection *conn_filter,
+ DBusMessageIter *arr_iter)
+{
+ int i;
+
+ for (i = 0 ; i < DBUS_NUM_MESSAGE_TYPES ; i++)
+ {
+ DBusHashIter iter;
+ DBusList **list;
+ DBusList *link;
+
+ _dbus_hash_iter_init (matchmaker->rules_by_type[i].rules_by_iface, &iter);
+ while (_dbus_hash_iter_next (&iter))
+ {
+ list = _dbus_hash_iter_get_value (&iter);
+ for (link = _dbus_list_get_first_link (list);
+ link != NULL;
+ link = _dbus_list_get_next_link (list, link))
+ {
+ BusMatchRule *rule = link->data;
+
+ if (rule->matches_go_to == conn_filter)
+ {
+ char *s = match_rule_to_string (rule);
+
+ if (s == NULL)
+ return FALSE;
+
+ if (!dbus_message_iter_append_basic (arr_iter, DBUS_TYPE_STRING, &s))
+ {
+ dbus_free (s);
+ return FALSE;
+ }
+ dbus_free (s);
+ }
+ }
+ }
+ list = &matchmaker->rules_by_type[i].rules_without_iface;
+ for (link = _dbus_list_get_first_link (list);
+ link != NULL;
+ link = _dbus_list_get_next_link (list, link))
+ {
+ BusMatchRule *rule = link->data;
+
+ if (rule->matches_go_to == conn_filter)
+ {
+ char *s = match_rule_to_string (rule);
+
+ if (s == NULL)
+ return FALSE;
+
+ if (!dbus_message_iter_append_basic (arr_iter, DBUS_TYPE_STRING, &s))
+ {
+ dbus_free (s);
+ return FALSE;
+ }
+ dbus_free (s);
+ }
+ }
+ }
+
+ return TRUE;
+}
+#endif
+
static void
rule_list_free (DBusList **rules)
{
@@ -1359,7 +1459,7 @@ bus_matchmaker_add_rule (BusMatchmaker *matchmaker,
char *s = match_rule_to_string (rule);
_dbus_verbose ("Added match rule %s to connection %p\n",
- s, rule->matches_go_to);
+ s ? s : "nomem", rule->matches_go_to);
dbus_free (s);
}
#endif
@@ -1452,7 +1552,7 @@ bus_matchmaker_remove_rule_link (DBusList **rules,
char *s = match_rule_to_string (rule);
_dbus_verbose ("Removed match rule %s for connection %p\n",
- s, rule->matches_go_to);
+ s ? s : "nomem", rule->matches_go_to);
dbus_free (s);
}
#endif
@@ -1489,7 +1589,7 @@ bus_matchmaker_remove_rule (BusMatchmaker *matchmaker,
char *s = match_rule_to_string (rule);
_dbus_verbose ("Removed match rule %s for connection %p\n",
- s, rule->matches_go_to);
+ s ? s : "nomem", rule->matches_go_to);
dbus_free (s);
}
#endif
@@ -1966,7 +2066,7 @@ get_recipients_from_list (DBusList **rules,
char *s = match_rule_to_string (rule);
_dbus_verbose ("Checking whether message matches rule %s for connection %p\n",
- s, rule->matches_go_to);
+ s ? s : "nomem", rule->matches_go_to);
dbus_free (s);
}
#endif
@@ -2401,7 +2501,12 @@ static struct {
{ "type='method_call',arg3='foosh'", "arg3='foosh',type='method_call'" },
{ "arg3='fool'", "arg3='fool'" },
{ "arg0namespace='fool'", "arg0namespace='fool'" },
- { "member='food'", "member='food'" }
+ { "member='food'", "member='food'" },
+ { "member=escape", "member='escape'" },
+ { "member=icecream", "member=ice'cream'" },
+ { "arg0='comma,type=comma',type=signal", "type=signal,arg0='comma,type=comma'" },
+ { "arg0=escap\\e", "arg0='escap\\e'" },
+ { "arg0=Time: 8 o\\'clock", "arg0='Time: 8 o'\\''clock'" },
};
static void
@@ -2414,6 +2519,8 @@ test_equality (void)
{
BusMatchRule *first;
BusMatchRule *second;
+ char *first_str, *second_str;
+ BusMatchRule *first_reparsed, *second_reparsed;
int j;
first = check_parse (TRUE, equality_tests[i].first);
@@ -2429,6 +2536,21 @@ test_equality (void)
exit (1);
}
+ /* Check match_rule_to_string */
+ first_str = match_rule_to_string (first);
+ _dbus_assert (first_str != NULL);
+ second_str = match_rule_to_string (second);
+ _dbus_assert (second_str != NULL);
+ _dbus_assert (strcmp (first_str, second_str) == 0);
+ first_reparsed = check_parse (TRUE, first_str);
+ second_reparsed = check_parse (TRUE, second_str);
+ _dbus_assert (match_rule_equal (first, first_reparsed));
+ _dbus_assert (match_rule_equal (second, second_reparsed));
+ bus_match_rule_unref (first_reparsed);
+ bus_match_rule_unref (second_reparsed);
+ dbus_free (first_str);
+ dbus_free (second_str);
+
bus_match_rule_unref (second);
/* Check that the rule is not equal to any of the
diff --git a/bus/signals.h b/bus/signals.h
index a71d2e45..d19fc7c5 100644
--- a/bus/signals.h
+++ b/bus/signals.h
@@ -77,6 +77,12 @@ BusMatchRule* bus_match_rule_parse (DBusConnection *matches_go_to,
const DBusString *rule_text,
DBusError *error);
+#ifdef DBUS_ENABLE_STATS
+dbus_bool_t bus_match_rule_dump (BusMatchmaker *matchmaker,
+ DBusConnection *conn_filter,
+ DBusMessageIter *arr_iter);
+#endif
+
BusMatchmaker* bus_matchmaker_new (void);
BusMatchmaker* bus_matchmaker_ref (BusMatchmaker *matchmaker);
void bus_matchmaker_unref (BusMatchmaker *matchmaker);
diff --git a/bus/stats.c b/bus/stats.c
index 24308eb5..859c6a52 100644
--- a/bus/stats.c
+++ b/bus/stats.c
@@ -30,6 +30,7 @@
#include "connection.h"
#include "services.h"
+#include "signals.h"
#include "utils.h"
#ifdef DBUS_ENABLE_STATS
@@ -217,4 +218,120 @@ oom:
return FALSE;
}
+
+dbus_bool_t
+bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+{
+ BusContext *context;
+ DBusString bus_name_str;
+ DBusMessage *reply = NULL;
+ DBusMessageIter iter, hash_iter, entry_iter, arr_iter;
+ BusRegistry *registry;
+ char **services = NULL;
+ int services_len;
+ DBusConnection *conn_filter = NULL;
+ BusMatchmaker *matchmaker;
+ int i;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ registry = bus_connection_get_registry (caller_connection);
+ context = bus_transaction_get_context (transaction);
+ matchmaker = bus_context_get_matchmaker (context);
+
+ if (!bus_registry_list_services (registry, &services, &services_len))
+ return FALSE;
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+ goto oom;
+
+ dbus_message_iter_init_append (reply, &iter);
+
+ if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "{sas}",
+ &hash_iter))
+ goto oom;
+
+ for (i = 0 ; i < services_len ; i++)
+ {
+ BusService *service;
+
+ /* To avoid duplicate entries, only look for unique names */
+ if (services[i][0] != ':')
+ continue;
+
+ _dbus_string_init_const (&bus_name_str, services[i]);
+ service = bus_registry_lookup (registry, &bus_name_str);
+ _dbus_assert (service != NULL);
+
+ conn_filter = bus_service_get_primary_owners_connection (service);
+ _dbus_assert (conn_filter != NULL);
+
+ if (!dbus_message_iter_open_container (&hash_iter, DBUS_TYPE_DICT_ENTRY, NULL,
+ &entry_iter))
+ {
+ dbus_message_iter_abandon_container (&iter, &hash_iter);
+ goto oom;
+ }
+
+ if (!dbus_message_iter_append_basic (&entry_iter, DBUS_TYPE_STRING, &services[i]))
+ {
+ dbus_message_iter_abandon_container (&hash_iter, &entry_iter);
+ dbus_message_iter_abandon_container (&iter, &hash_iter);
+ goto oom;
+ }
+
+ if (!dbus_message_iter_open_container (&entry_iter, DBUS_TYPE_ARRAY, "s",
+ &arr_iter))
+ {
+ dbus_message_iter_abandon_container (&hash_iter, &entry_iter);
+ dbus_message_iter_abandon_container (&iter, &hash_iter);
+ goto oom;
+ }
+
+ if (!bus_match_rule_dump (matchmaker, conn_filter, &arr_iter))
+ {
+ dbus_message_iter_abandon_container (&entry_iter, &arr_iter);
+ dbus_message_iter_abandon_container (&hash_iter, &entry_iter);
+ dbus_message_iter_abandon_container (&iter, &hash_iter);
+ goto oom;
+ }
+
+ if (!dbus_message_iter_close_container (&entry_iter, &arr_iter))
+ {
+ dbus_message_iter_abandon_container (&hash_iter, &entry_iter);
+ dbus_message_iter_abandon_container (&iter, &hash_iter);
+ goto oom;
+ }
+ if (!dbus_message_iter_close_container (&hash_iter, &entry_iter))
+ {
+ dbus_message_iter_abandon_container (&iter, &hash_iter);
+ goto oom;
+ }
+ }
+
+ if (!dbus_message_iter_close_container (&iter, &hash_iter))
+ goto oom;
+
+ if (!bus_transaction_send_from_driver (transaction, caller_connection,
+ reply))
+ goto oom;
+
+ dbus_message_unref (reply);
+ dbus_free_string_array (services);
+ return TRUE;
+
+oom:
+ if (reply != NULL)
+ dbus_message_unref (reply);
+
+ dbus_free_string_array (services);
+
+ BUS_SET_OOM (error);
+ return FALSE;
+}
+
#endif
diff --git a/bus/stats.h b/bus/stats.h
index 0f843db5..dcb022c4 100644
--- a/bus/stats.h
+++ b/bus/stats.h
@@ -35,4 +35,9 @@ dbus_bool_t bus_stats_handle_get_connection_stats (DBusConnection *connection,
DBusMessage *message,
DBusError *error);
+dbus_bool_t bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error);
+
#endif /* multiple-inclusion guard */
diff --git a/bus/system.conf.in b/bus/system.conf.in
index 92f4cc42..c1541bff 100644
--- a/bus/system.conf.in
+++ b/bus/system.conf.in
@@ -63,11 +63,24 @@
<allow receive_type="signal"/>
<!-- Allow anyone to talk to the message bus -->
- <allow send_destination="org.freedesktop.DBus"/>
+ <allow send_destination="org.freedesktop.DBus"
+ send_interface="org.freedesktop.DBus" />
+ <allow send_destination="org.freedesktop.DBus"
+ send_interface="org.freedesktop.DBus.Introspectable"/>
<!-- But disallow some specific bus services -->
<deny send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus"
send_member="UpdateActivationEnvironment"/>
+ <deny send_destination="org.freedesktop.DBus"
+ send_interface="org.freedesktop.DBus.Debug.Stats"/>
+ </policy>
+
+ <!-- If the Stats interface was enabled at compile-time, root may use it.
+ Copy this into system.local.conf or system.d/*.conf if you want to
+ enable other privileged users to view statistics and debug info -->
+ <policy user="root">
+ <allow send_destination="org.freedesktop.DBus"
+ send_interface="org.freedesktop.DBus.Debug.Stats"/>
</policy>
<!-- Config files are placed here that among other things, punch
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index c767c171..628a681a 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -73,7 +73,7 @@ set(EXPANDED_DATADIR ${DBUS_INSTALL_DIR}/${DBUS_DATADIR})
set(DBUS_MACHINE_UUID_FILE ${DBUS_INSTALL_DIR}/lib/dbus/machine-id)
set(DBUS_BINDIR ${EXPANDED_BINDIR})
set(DBUS_DAEMONDIR ${EXPANDED_BINDIR})
-
+set(DBUS_LOCALSTATEDIR ${DBUS_INSTALL_DIR}/var)
#enable building of shared library
SET(BUILD_SHARED_LIBS ON)
@@ -136,7 +136,6 @@ if(VCS)
endif(VCS)
if(WIN32)
- set(CMAKE_DEBUG_POSTFIX "d")
if(MSVC)
# controll folders in msvc projects
include(ProjectSourceGroup)
@@ -401,13 +400,8 @@ endif (MSVC_IDE)
endif (NOT $ENV{TEMP} STREQUAL "")
endif (NOT $ENV{TMPDIR} STREQUAL "")
-# TODO: fix redhet
-if (WIN32)
- # bus-test expects a non empty string
- set (DBUS_SYSTEM_PID_FILE "/dbus-pid")
-else (WIN32)
- set (DBUS_SYSTEM_PID_FILE ${EXPANDED_LOCALSTATEDIR}/run/dbus/pid)
-endif (WIN32)
+ # Not used on Windows, where there is no system bus
+set (DBUS_SYSTEM_PID_FILE ${DBUS_LOCALSTATEDIR}/run/dbus/pid)
if (WIN32)
set (DBUS_CONSOLE_AUTH_DIR "")
@@ -425,7 +419,7 @@ set (DBUS_USER )
# 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")
+set (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "unix:path=${DBUS_LOCALSTATEDIR}/run/dbus/system_bus_socket" CACHE STRING "system bus default address")
if (WIN32)
set (DBUS_SESSION_BUS_LISTEN_ADDRESS "autolaunch:" CACHE STRING "session bus default listening address")
diff --git a/cmake/bus/CMakeLists.txt b/cmake/bus/CMakeLists.txt
index f5b41cd8..2ff6c9bc 100644
--- a/cmake/bus/CMakeLists.txt
+++ b/cmake/bus/CMakeLists.txt
@@ -3,17 +3,14 @@ add_definitions(-DDBUS_COMPILATION)
SET(EFENCE "")
SET(BUS_DIR ${CMAKE_SOURCE_DIR}/../bus)
-set (config_DATA
- session.conf
- system.conf
-)
-
# config files for installation
CONFIGURE_FILE( "${BUS_DIR}/session.conf.in" "${CMAKE_CURRENT_BINARY_DIR}/session.conf" IMMEDIATE @ONLY)
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/session.d)
-CONFIGURE_FILE( "system.conf.cmake" "${CMAKE_CURRENT_BINARY_DIR}/system.conf" IMMEDIATE @ONLY)
-FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/system.d)
+if(NOT WIN32)
+ CONFIGURE_FILE( "system.conf.cmake" "${CMAKE_CURRENT_BINARY_DIR}/system.conf" IMMEDIATE @ONLY)
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/system.d)
+endif()
# copy services for local daemon start to local service dir data/dbus-1/services
SET (SERVICE_FILES test/data/valid-service-files)
@@ -80,7 +77,11 @@ if(DBUS_ENABLE_STATS)
)
endif(DBUS_ENABLE_STATS)
-include_directories(${XML_INCLUDE_DIR})
+include_directories(
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/..
+ ${XML_INCLUDE_DIR}
+)
add_executable(dbus-daemon ${BUS_SOURCES} ${BUS_DIR}/main.c)
target_link_libraries(dbus-daemon ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
@@ -88,8 +89,16 @@ set_target_properties(dbus-daemon PROPERTIES OUTPUT_NAME ${DBUS_DAEMON_NAME})
set_target_properties(dbus-daemon PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
install_targets(/bin dbus-daemon)
-install_files(/etc/dbus-1 FILES ${config_DATA})
-install(DIRECTORY . DESTINATION etc/dbus-1/session.d FILES_MATCHING PATTERN "*.conf")
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/session.conf DESTINATION etc/dbus-1)
+install(DIRECTORY DESTINATION etc/dbus-1/session.d)
+install(DIRECTORY DESTINATION share/dbus-1/services)
+
+if(NOT WIN32)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/system.conf DESTINATION etc/dbus-1)
+ install(DIRECTORY DESTINATION etc/dbus-1/system.d)
+ install(DIRECTORY DESTINATION share/dbus-1/system-services)
+ install(DIRECTORY DESTINATION var/run/dbus)
+endif()
if (DBUS_SERVICE)
set (dbus_service_SOURCES
@@ -109,6 +118,16 @@ if (DBUS_ENABLE_EMBEDDED_TESTS)
set(SOURCES ${BUS_SOURCES} ${BUS_DIR}/test-main.c)
add_test_executable(test-bus "${SOURCES}" ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
set_target_properties(test-bus PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
+ if (NOT DBUS_WIN32)
+ set(test_bus_system_SOURCES
+ ${XML_SOURCES}
+ ${BUS_DIR}/config-parser-common.c
+ ${BUS_DIR}/config-parser-trivial.c
+ ${BUS_DIR}/utils.c
+ ${BUS_DIR}/test-system.c
+ )
+ add_test_executable(test-bus-system "${test_bus_system_SOURCES}" ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} ${DBUS_BUS_LIBS})
+ endif()
endif (DBUS_ENABLE_EMBEDDED_TESTS)
if(MSVC)
diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt
index a5481b78..a6aaba07 100644
--- a/cmake/dbus/CMakeLists.txt
+++ b/cmake/dbus/CMakeLists.txt
@@ -214,14 +214,12 @@ else (WIN32)
${DBUS_DIR}/dbus-sysdeps-unix.c
${DBUS_DIR}/dbus-sysdeps-pthread.c
${DBUS_DIR}/dbus-userdb.c
- ${DBUS_DIR}/sd-daemon.c
)
set (DBUS_SHARED_HEADERS ${DBUS_SHARED_HEADERS}
${DBUS_DIR}/dbus-server-unix.h
${DBUS_DIR}/dbus-transport-unix.h
${DBUS_DIR}/dbus-sysdeps-unix.h
${DBUS_DIR}/dbus-userdb.h
- ${DBUS_DIR}/sd-daemon.h
)
set (DBUS_UTIL_SOURCES ${DBUS_UTIL_SOURCES}
${DBUS_DIR}/dbus-spawn.c
@@ -261,13 +259,29 @@ add_library(dbus-1 SHARED
${libdbus_SOURCES}
${libdbus_HEADERS}
)
+if(DBUS_LIBRARY_REVISION)
+ math(EXPR DBUS_LIBRARY_MAJOR "${DBUS_LIBRARY_CURRENT} - ${DBUS_LIBRARY_AGE}")
+endif()
+
if(WIN32)
+ if(DBUS_LIBRARY_REVISION)
+ get_target_property(LEGACY_FILE_NAME dbus-1 LOCATION)
+ set_target_properties(dbus-1 PROPERTIES SUFFIX "-${DBUS_LIBRARY_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ add_custom_command(TARGET dbus-1 POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:dbus-1>" "${LEGACY_FILE_NAME}"
+ COMMENT "Create non versioned dbus-1 library for legacy applications"
+ )
+ install(FILES ${LEGACY_FILE_NAME} DESTINATION bin)
+ endif()
if(WINCE)
target_link_libraries(dbus-1 ws2)
else(WINCE)
target_link_libraries(dbus-1 ws2_32 advapi32 netapi32 iphlpapi)
endif(WINCE)
else(WIN32)
+ if(DBUS_LIBRARY_REVISION)
+ set_target_properties(dbus-1 PROPERTIES VERSION ${DBUS_LIBRARY_MAJOR}.${DBUS_LIBRARY_AGE}.${DBUS_LIBRARY_REVISION} SOVERSION ${DBUS_LIBRARY_MAJOR})
+ endif()
target_link_libraries(dbus-1 ${CMAKE_THREAD_LIBS_INIT} rt)
endif(WIN32)
diff --git a/cmake/doc/CMakeLists.txt b/cmake/doc/CMakeLists.txt
index 7fdfc219..807af60c 100644
--- a/cmake/doc/CMakeLists.txt
+++ b/cmake/doc/CMakeLists.txt
@@ -20,6 +20,8 @@ find_program(MEINPROC4_EXECUTABLE meinproc4)
find_program(XMLTO_EXECUTABLE xmlto)
+find_program(CYGPATH_EXECUTABLE cygpath)
+
if (MEINPROC4_EXECUTABLE OR XMLTO_EXECUTABLE)
OPTION(DBUS_ENABLE_XML_DOCS "build XML documentation (requires xmlto or meinproc4)" ON)
ADD_CUSTOM_TARGET(xmldoc ALL)
@@ -71,6 +73,19 @@ macro (DOCBOOK _sources _format)
)
endif ()
if (XMLTO_EXECUTABLE)
+ if (MSYS)
+ if (CYGPATH_EXECUTABLE)
+ execute_process(
+ COMMAND cygpath ${_infile}
+ OUTPUT_VARIABLE _infile)
+ else ()
+ execute_process(COMMAND dirname ${_infile} OUTPUT_VARIABLE _path)
+ string(STRIP ${_path} _path)
+ execute_process(COMMAND sh -c "cd ${_path}; pwd -W" OUTPUT_VARIABLE _path)
+ string(STRIP ${_path} _path)
+ set(_infile "${_path}/${_name}")
+ endif(CYGPATH_EXECUTABLE)
+ endif (MSYS)
ADD_CUSTOM_COMMAND(
OUTPUT ${_outfile}
COMMAND ${XMLTO_EXECUTABLE} -vv ${_format} ${_infile}
diff --git a/cmake/modules/MacrosAutotools.cmake b/cmake/modules/MacrosAutotools.cmake
index 68e8ae51..2b1c59d4 100644
--- a/cmake/modules/MacrosAutotools.cmake
+++ b/cmake/modules/MacrosAutotools.cmake
@@ -10,6 +10,9 @@
# ${prefix}_MAJOR_VERSION
# ${prefix}_MINOR_VERSION
# ${prefix}_MICRO_VERSION
+# ${prefix}_LIBRARY_AGE
+# ${prefix}_LIBRARY_REVISION
+# ${prefix}_LIBRARY_CURRENT
#
macro(autoversion config prefix)
file (READ ${config} _configure_ac)
@@ -19,7 +22,9 @@ macro(autoversion config prefix)
string (REGEX REPLACE ".*${prefix}_micro_version], .([0-9]+).*" "\\1" ${prefix_upper}_MICRO_VERSION ${_configure_ac})
set (${prefix_upper}_VERSION ${${prefix_upper}_MAJOR_VERSION}.${${prefix_upper}_MINOR_VERSION}.${${prefix_upper}_MICRO_VERSION})
set (${prefix_upper}_VERSION_STRING "${${prefix_upper}_VERSION}")
-
+ string (REGEX REPLACE ".*LT_AGE=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_AGE ${_configure_ac})
+ string (REGEX REPLACE ".*LT_CURRENT=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_CURRENT ${_configure_ac})
+ string (REGEX REPLACE ".*LT_REVISION=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_REVISION ${_configure_ac})
endmacro()
#
diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt
index 9195eae7..13f639b1 100644
--- a/cmake/test/CMakeLists.txt
+++ b/cmake/test/CMakeLists.txt
@@ -1,6 +1,8 @@
add_definitions(${DBUS_INTERNAL_CLIENT_DEFINITIONS})
+include_directories(${CMAKE_SOURCE_DIR}/../test)
+
set(DBUS_SESSION_BUS_LISTEN_ADDRESS ${TEST_LISTEN})
add_library(dbus-testutils STATIC
@@ -11,6 +13,10 @@ target_link_libraries(dbus-testutils ${DBUS_INTERNAL_LIBRARIES})
add_subdirectory( name-test )
+set (manual-dir-iter_SOURCES
+ ${CMAKE_SOURCE_DIR}/../test/manual-dir-iter.c
+)
+
set (test-service_SOURCES
${CMAKE_SOURCE_DIR}/../test/test-service.c
)
@@ -47,6 +53,7 @@ set (test-sleep-forever_SOURCES
${CMAKE_SOURCE_DIR}/../test/test-sleep-forever.c
)
+add_helper_executable(manual-dir-iter ${manual-dir-iter_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
add_helper_executable(test-service ${test-service_SOURCES} dbus-testutils)
add_helper_executable(test-names ${test-names_SOURCES} dbus-testutils)
add_test_executable(test-shell ${test-shell_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
diff --git a/cmake/tools/CMakeLists.txt b/cmake/tools/CMakeLists.txt
index ddbd5bcf..9f363b7a 100644
--- a/cmake/tools/CMakeLists.txt
+++ b/cmake/tools/CMakeLists.txt
@@ -45,3 +45,6 @@ install_targets(/bin dbus-launch )
add_executable(dbus-monitor ${dbus_monitor_SOURCES})
target_link_libraries(dbus-monitor ${DBUS_LIBRARIES})
install_targets(/bin dbus-monitor )
+
+# create the /var/lib/dbus directory for dbus-uuidgen
+install(DIRECTORY DESTINATION var/lib/dbus)
diff --git a/config.h.in b/config.h.in
index 5d624fb3..e7ff3e4c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -132,7 +132,7 @@
/* The name of the gettext domain */
#undef GETTEXT_PACKAGE
-/* Prevent post-2.32 APIs */
+/* Prevent post-2.38 APIs */
#undef GLIB_VERSION_MAX_ALLOWED
/* Ignore post-2.26 deprecations */
@@ -153,7 +153,7 @@
/* Define to 1 if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H
-/* Define to 1 if you have the `backtrace' function. */
+/* Define to 1 if you have backtrace(). */
#undef HAVE_BACKTRACE
/* Define to 1 if you have the <byteswap.h> header file. */
@@ -215,6 +215,9 @@
/* Define to 1 if you have the `getresuid' function. */
#undef HAVE_GETRESUID
+/* Define to 1 if you have the `getrlimit' function. */
+#undef HAVE_GETRLIMIT
+
/* Have GNU-style varargs macros */
#undef HAVE_GNUC_VARARGS
diff --git a/config.sub b/config.sub
index d654d03c..bba4efb8 100755
--- a/config.sub
+++ b/config.sub
@@ -2,7 +2,7 @@
# Configuration validation subroutine script.
# Copyright 1992-2014 Free Software Foundation, Inc.
-timestamp='2014-05-01'
+timestamp='2014-09-11'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -302,6 +302,7 @@ case $basic_machine in
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
+ | riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
@@ -828,6 +829,10 @@ case $basic_machine in
basic_machine=powerpc-unknown
os=-morphos
;;
+ moxiebox)
+ basic_machine=moxie-unknown
+ os=-moxiebox
+ ;;
msdos)
basic_machine=i386-pc
os=-msdos
@@ -1373,7 +1378,7 @@ case $os in
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
diff --git a/configure b/configure
index fb0d5176..203fbc2d 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for dbus 1.8.8.
+# Generated by GNU Autoconf 2.69 for dbus 1.9.0.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=dbus>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='dbus'
PACKAGE_TARNAME='dbus'
-PACKAGE_VERSION='1.8.8'
-PACKAGE_STRING='dbus 1.8.8'
+PACKAGE_VERSION='1.9.0'
+PACKAGE_STRING='dbus 1.9.0'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=dbus'
PACKAGE_URL=''
@@ -1513,7 +1513,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures dbus 1.8.8 to adapt to many kinds of systems.
+\`configure' configures dbus 1.9.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1587,7 +1587,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of dbus 1.8.8:";;
+ short | recursive ) echo "Configuration of dbus 1.9.0:";;
esac
cat <<\_ACEOF
@@ -1641,7 +1641,7 @@ Optional Features:
--enable-x11-autolaunch build with X11 auto-launch support
--disable-Werror compile without -Werror (normally enabled in
development builds)
- --enable-stats enable bus daemon usage statistics
+ --disable-stats disable bus daemon usage statistics
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1784,7 +1784,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-dbus configure 1.8.8
+dbus configure 1.9.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2503,7 +2503,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by dbus $as_me 1.8.8, which was
+It was created by dbus $as_me 1.9.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3446,7 +3446,7 @@ fi
# Define the identity of the package.
PACKAGE='dbus'
- VERSION='1.8.8'
+ VERSION='1.9.0'
cat >>confdefs.h <<_ACEOF
@@ -3742,25 +3742,25 @@ _ACEOF
#
## increment if the interface has additions, changes, removals.
-LT_CURRENT=11
+LT_CURRENT=12
## increment any time the source changes; set to
## 0 if you increment CURRENT
-LT_REVISION=7
+LT_REVISION=0
## increment if any interfaces have been added; set to 0
## if any interfaces have been changed or removed. removal has
## precedence over adding, so set to 0 if both happened.
-LT_AGE=8
+LT_AGE=9
DBUS_MAJOR_VERSION=1
-DBUS_MINOR_VERSION=8
-DBUS_MICRO_VERSION=8
-DBUS_VERSION=1.8.8
+DBUS_MINOR_VERSION=9
+DBUS_MICRO_VERSION=0
+DBUS_VERSION=1.9.0
@@ -16923,7 +16923,7 @@ fi
$as_echo "#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_26" >>confdefs.h
-$as_echo "#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_32" >>confdefs.h
+$as_echo "#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_38" >>confdefs.h
with_glib=yes
@@ -18674,7 +18674,7 @@ fi
fi
-for ac_func in vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull issetugid getresuid
+for ac_func in vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull issetugid getresuid getrlimit
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -18906,16 +18906,63 @@ if test "x$ac_cv_header_execinfo_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_EXECINFO_H 1
_ACEOF
- for ac_func in backtrace
-do :
- ac_fn_c_check_func "$LINENO" "backtrace" "ac_cv_func_backtrace"
-if test "x$ac_cv_func_backtrace" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_BACKTRACE 1
-_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace" >&5
+$as_echo_n "checking for library containing backtrace... " >&6; }
+if ${ac_cv_search_backtrace+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char backtrace ();
+int
+main ()
+{
+return backtrace ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' execinfo; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_backtrace=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_backtrace+:} false; then :
+ break
fi
done
+if ${ac_cv_search_backtrace+:} false; then :
+
+else
+ ac_cv_search_backtrace=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace" >&5
+$as_echo "$ac_cv_search_backtrace" >&6; }
+ac_res=$ac_cv_search_backtrace
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+$as_echo "#define HAVE_BACKTRACE 1" >>confdefs.h
+
+fi
fi
@@ -20802,7 +20849,7 @@ $as_echo "#define WITH_VALGRIND 1" >>confdefs.h
fi
#### Set up final flags
-LIBDBUS_LIBS="$THREAD_LIBS $NETWORK_libs"
+LIBDBUS_LIBS="$THREAD_LIBS $NETWORK_libs $SYSTEMD_LIBS"
### X11 detection
@@ -22782,7 +22829,7 @@ fi
if test "${enable_stats+set}" = set; then :
enableval=$enable_stats;
else
- enable_stats=no
+ enable_stats=yes
fi
if test "x$enable_stats" = xyes; then
@@ -22791,7 +22838,7 @@ $as_echo "#define DBUS_ENABLE_STATS 1" >>confdefs.h
fi
-ac_config_files="$ac_config_files Doxyfile dbus/versioninfo.rc dbus/dbus-arch-deps.h bus/system.conf bus/session.conf bus/messagebus bus/messagebus-config bus/org.freedesktop.dbus-session.plist bus/rc.messagebus bus/dbus.service bus/dbus.socket Makefile dbus/Makefile bus/Makefile tools/Makefile test/Makefile test/name-test/Makefile doc/Makefile doc/dbus-cleanup-sockets.1.xml doc/dbus-daemon.1.xml doc/dbus-launch.1.xml doc/dbus-monitor.1.xml doc/dbus-run-session.1.xml doc/dbus-send.1.xml doc/dbus-uuidgen.1.xml dbus-1.pc dbus-1-uninstalled.pc test/data/valid-config-files/debug-allow-all.conf test/data/valid-config-files/debug-allow-all-sha1.conf test/data/valid-config-files/incoming-limit.conf test/data/valid-config-files-system/debug-allow-all-pass.conf test/data/valid-config-files-system/debug-allow-all-fail.conf test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service"
+ac_config_files="$ac_config_files Doxyfile dbus/versioninfo.rc dbus/dbus-arch-deps.h bus/system.conf bus/session.conf bus/example-system-enable-stats.conf bus/example-session-disable-stats.conf bus/messagebus bus/messagebus-config bus/org.freedesktop.dbus-session.plist bus/rc.messagebus bus/dbus.service bus/dbus.socket Makefile dbus/Makefile bus/Makefile tools/Makefile test/Makefile test/name-test/Makefile doc/Makefile doc/dbus-cleanup-sockets.1.xml doc/dbus-daemon.1.xml doc/dbus-launch.1.xml doc/dbus-monitor.1.xml doc/dbus-run-session.1.xml doc/dbus-send.1.xml doc/dbus-uuidgen.1.xml dbus-1.pc dbus-1-uninstalled.pc test/data/valid-config-files/debug-allow-all.conf test/data/valid-config-files/debug-allow-all-sha1.conf test/data/valid-config-files/incoming-limit.conf test/data/valid-config-files-system/debug-allow-all-pass.conf test/data/valid-config-files-system/debug-allow-all-fail.conf test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -23428,7 +23475,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by dbus $as_me 1.8.8, which was
+This file was extended by dbus $as_me 1.9.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -23494,7 +23541,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-dbus config.status 1.8.8
+dbus config.status 1.9.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -24092,6 +24139,8 @@ do
"dbus/dbus-arch-deps.h") CONFIG_FILES="$CONFIG_FILES dbus/dbus-arch-deps.h" ;;
"bus/system.conf") CONFIG_FILES="$CONFIG_FILES bus/system.conf" ;;
"bus/session.conf") CONFIG_FILES="$CONFIG_FILES bus/session.conf" ;;
+ "bus/example-system-enable-stats.conf") CONFIG_FILES="$CONFIG_FILES bus/example-system-enable-stats.conf" ;;
+ "bus/example-session-disable-stats.conf") CONFIG_FILES="$CONFIG_FILES bus/example-session-disable-stats.conf" ;;
"bus/messagebus") CONFIG_FILES="$CONFIG_FILES bus/messagebus" ;;
"bus/messagebus-config") CONFIG_FILES="$CONFIG_FILES bus/messagebus-config" ;;
"bus/org.freedesktop.dbus-session.plist") CONFIG_FILES="$CONFIG_FILES bus/org.freedesktop.dbus-session.plist" ;;
diff --git a/configure.ac b/configure.ac
index 2d4624c7..2f62269e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,8 +2,8 @@ dnl -*- mode: m4 -*-
AC_PREREQ([2.63])
m4_define([dbus_major_version], [1])
-m4_define([dbus_minor_version], [8])
-m4_define([dbus_micro_version], [8])
+m4_define([dbus_minor_version], [9])
+m4_define([dbus_micro_version], [0])
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])
@@ -33,16 +33,16 @@ AC_DEFINE_UNQUOTED(DBUS_DAEMON_NAME,"dbus-daemon",[Name of executable])
#
## increment if the interface has additions, changes, removals.
-LT_CURRENT=11
+LT_CURRENT=12
## increment any time the source changes; set to
## 0 if you increment CURRENT
-LT_REVISION=7
+LT_REVISION=0
## increment if any interfaces have been added; set to 0
## if any interfaces have been changed or removed. removal has
## precedence over adding, so set to 0 if both happened.
-LT_AGE=8
+LT_AGE=9
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
@@ -208,7 +208,7 @@ fi
# or binaries.
AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_26], [Ignore post-2.26 deprecations])
-AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_32], [Prevent post-2.32 APIs])
+AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_38], [Prevent post-2.38 APIs])
with_glib=yes
@@ -591,7 +591,7 @@ AC_DEFINE_UNQUOTED([DBUS_USE_SYNC], [$have_sync], [Use the gcc __sync extension]
AC_SEARCH_LIBS(socket,[socket network])
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
-AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull issetugid getresuid)
+AC_CHECK_FUNCS([vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull issetugid getresuid getrlimit])
AC_CHECK_HEADERS([syslog.h])
if test "x$ac_cv_header_syslog_h" = "xyes"; then
@@ -669,7 +669,10 @@ AC_CHECK_HEADERS(sys/resource.h)
AC_CHECK_HEADERS(dirent.h)
-AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
+AC_CHECK_HEADERS([execinfo.h],
+ [AC_SEARCH_LIBS([backtrace], [execinfo],
+ [AC_DEFINE([HAVE_BACKTRACE], [1],
+ [Define to 1 if you have backtrace().])])])
AC_CHECK_HEADERS(errno.h)
@@ -1243,7 +1246,7 @@ if test x$with_valgrind != xno; then
fi
#### Set up final flags
-LIBDBUS_LIBS="$THREAD_LIBS $NETWORK_libs"
+LIBDBUS_LIBS="$THREAD_LIBS $NETWORK_libs $SYSTEMD_LIBS"
AC_SUBST([LIBDBUS_LIBS])
### X11 detection
@@ -1733,9 +1736,9 @@ AH_VERBATIM(_DARWIN_ENVIRON,
])
AC_ARG_ENABLE([stats],
- [AS_HELP_STRING([--enable-stats],
- [enable bus daemon usage statistics])],
- [], [enable_stats=no])
+ [AS_HELP_STRING([--disable-stats],
+ [disable bus daemon usage statistics])],
+ [], [enable_stats=yes])
if test "x$enable_stats" = xyes; then
AC_DEFINE([DBUS_ENABLE_STATS], [1],
[Define to enable bus daemon usage statistics])
@@ -1747,6 +1750,8 @@ dbus/versioninfo.rc
dbus/dbus-arch-deps.h
bus/system.conf
bus/session.conf
+bus/example-system-enable-stats.conf
+bus/example-session-disable-stats.conf
bus/messagebus
bus/messagebus-config
bus/org.freedesktop.dbus-session.plist
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
index b2481073..442fd27c 100644
--- a/dbus/Makefile.am
+++ b/dbus/Makefile.am
@@ -12,10 +12,6 @@ AM_CPPFLAGS = \
-DDBUS_SESSION_CONFIG_FILE=\""$(configdir)/session.conf"\" \
$(NULL)
-# On Linux with glibc 2.17, sd-daemon.c support for POSIX message queues
-# results in an otherwise unnecessary dependency on librt. Disable it.
-AM_CPPFLAGS += -DSD_DAEMON_DISABLE_MQ
-
# if assertions are enabled, improve backtraces
AM_LDFLAGS = @R_DYNAMIC_LDFLAG@
@@ -108,8 +104,7 @@ DBUS_SHARED_arch_sources = \
dbus-transport-unix.h \
dbus-userdb.c \
dbus-userdb.h \
- sd-daemon.c \
- sd-daemon.h
+ $(NULL)
DBUS_UTIL_arch_sources = \
dbus-sysdeps-util-unix.c \
@@ -295,7 +290,7 @@ libdbus_internal_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DDBUS_STATIC_BUILD \
$(NULL)
-libdbus_internal_la_LIBADD=$(LIBDBUS_LIBS) $(SYSTEMD_LIBS)
+libdbus_internal_la_LIBADD=$(LIBDBUS_LIBS)
if DBUS_WIN
# This must be a separate convenience library, otherwise libtool notices
@@ -323,7 +318,3 @@ test_dbus_LDADD = libdbus-internal.la
## mop up the gcov files
clean-local:
/bin/rm *.bb *.bbg *.da *.gcov .libs/*.da .libs/*.bbg || true
-
-update-systemd:
- curl http://cgit.freedesktop.org/systemd/systemd/plain/src/libsystemd-daemon/sd-daemon.c > $(srcdir)/sd-daemon.c
- curl http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-daemon.h > $(srcdir)/sd-daemon.h
diff --git a/dbus/Makefile.in b/dbus/Makefile.in
index 43e3c7d0..3205e165 100644
--- a/dbus/Makefile.in
+++ b/dbus/Makefile.in
@@ -172,10 +172,9 @@ am__libdbus_1_la_SOURCES_DIST = dbus-address.c dbus-auth.c dbus-auth.h \
dbus-server-launchd.c dbus-file-unix.c dbus-pipe-unix.c \
dbus-sysdeps-unix.c dbus-sysdeps-unix.h dbus-sysdeps-pthread.c \
dbus-transport-unix.c dbus-transport-unix.h dbus-userdb.c \
- dbus-userdb.h sd-daemon.c sd-daemon.h \
- dbus-sysdeps-wince-glue.h dbus-sysdeps-wince-glue.c \
- dbus-file-win.c dbus-pipe-win.c dbus-sockets-win.h \
- dbus-sysdeps-win.c dbus-sysdeps-win.h \
+ dbus-userdb.h dbus-sysdeps-wince-glue.h \
+ dbus-sysdeps-wince-glue.c dbus-file-win.c dbus-pipe-win.c \
+ dbus-sockets-win.h dbus-sysdeps-win.c dbus-sysdeps-win.h \
dbus-sysdeps-thread-win.c dbus-transport-win.c \
dbus-transport-win.h dbus-sysdeps.c dbus-sysdeps.h \
dbus-valgrind-internal.h
@@ -209,8 +208,7 @@ am__objects_2 = libdbus_1_la-dbus-address.lo libdbus_1_la-dbus-auth.lo \
@DBUS_WIN_FALSE@ libdbus_1_la-dbus-sysdeps-unix.lo \
@DBUS_WIN_FALSE@ libdbus_1_la-dbus-sysdeps-pthread.lo \
@DBUS_WIN_FALSE@ libdbus_1_la-dbus-transport-unix.lo \
-@DBUS_WIN_FALSE@ libdbus_1_la-dbus-userdb.lo \
-@DBUS_WIN_FALSE@ libdbus_1_la-sd-daemon.lo
+@DBUS_WIN_FALSE@ libdbus_1_la-dbus-userdb.lo
@DBUS_WIN_TRUE@am__objects_5 = $(am__objects_4) \
@DBUS_WIN_TRUE@ libdbus_1_la-dbus-file-win.lo \
@DBUS_WIN_TRUE@ libdbus_1_la-dbus-pipe-win.lo \
@@ -239,7 +237,7 @@ am__libdbus_init_win_la_SOURCES_DIST = dbus-init-win.cpp
libdbus_init_win_la_OBJECTS = $(am_libdbus_init_win_la_OBJECTS)
@DBUS_WIN_TRUE@am_libdbus_init_win_la_rpath =
libdbus_internal_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__append_4)
+ $(am__append_4)
am__libdbus_internal_la_SOURCES_DIST = dbus-address.c dbus-auth.c \
dbus-auth.h dbus-bus.c dbus-connection.c \
dbus-connection-internal.h dbus-credentials.c \
@@ -270,10 +268,9 @@ am__libdbus_internal_la_SOURCES_DIST = dbus-address.c dbus-auth.c \
dbus-server-launchd.c dbus-file-unix.c dbus-pipe-unix.c \
dbus-sysdeps-unix.c dbus-sysdeps-unix.h dbus-sysdeps-pthread.c \
dbus-transport-unix.c dbus-transport-unix.h dbus-userdb.c \
- dbus-userdb.h sd-daemon.c sd-daemon.h \
- dbus-sysdeps-wince-glue.h dbus-sysdeps-wince-glue.c \
- dbus-file-win.c dbus-pipe-win.c dbus-sockets-win.h \
- dbus-sysdeps-win.c dbus-sysdeps-win.h \
+ dbus-userdb.h dbus-sysdeps-wince-glue.h \
+ dbus-sysdeps-wince-glue.c dbus-file-win.c dbus-pipe-win.c \
+ dbus-sockets-win.h dbus-sysdeps-win.c dbus-sysdeps-win.h \
dbus-sysdeps-thread-win.c dbus-transport-win.c \
dbus-transport-win.h dbus-sysdeps.c dbus-sysdeps.h \
dbus-valgrind-internal.h dbus-asv-util.c dbus-asv-util.h \
@@ -326,8 +323,7 @@ am__objects_8 = libdbus_internal_la-dbus-address.lo \
@DBUS_WIN_FALSE@ libdbus_internal_la-dbus-sysdeps-unix.lo \
@DBUS_WIN_FALSE@ libdbus_internal_la-dbus-sysdeps-pthread.lo \
@DBUS_WIN_FALSE@ libdbus_internal_la-dbus-transport-unix.lo \
-@DBUS_WIN_FALSE@ libdbus_internal_la-dbus-userdb.lo \
-@DBUS_WIN_FALSE@ libdbus_internal_la-sd-daemon.lo
+@DBUS_WIN_FALSE@ libdbus_internal_la-dbus-userdb.lo
@DBUS_WIN_TRUE@am__objects_11 = $(am__objects_10) \
@DBUS_WIN_TRUE@ libdbus_internal_la-dbus-file-win.lo \
@DBUS_WIN_TRUE@ libdbus_internal_la-dbus-pipe-win.lo \
@@ -667,15 +663,17 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
configdir = $(sysconfdir)/dbus-1
-
-# On Linux with glibc 2.17, sd-daemon.c support for POSIX message queues
-# results in an otherwise unnecessary dependency on librt. Disable it.
-AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) $(SYSTEMD_CFLAGS) \
- $(VALGRIND_CFLAGS) -DDBUS_COMPILATION \
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ $(SYSTEMD_CFLAGS) \
+ $(VALGRIND_CFLAGS) \
+ -DDBUS_COMPILATION \
-DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/lib/dbus/machine-id"\" \
-DDBUS_SYSTEM_CONFIG_FILE=\""$(configdir)/system.conf"\" \
-DDBUS_SESSION_CONFIG_FILE=\""$(configdir)/session.conf"\" \
- $(NULL) -DSD_DAEMON_DISABLE_MQ
+ $(NULL)
+
# if assertions are enabled, improve backtraces
AM_LDFLAGS = @R_DYNAMIC_LDFLAG@
@@ -725,8 +723,7 @@ lib_LTLIBRARIES = libdbus-1.la
@DBUS_WIN_FALSE@ dbus-transport-unix.h \
@DBUS_WIN_FALSE@ dbus-userdb.c \
@DBUS_WIN_FALSE@ dbus-userdb.h \
-@DBUS_WIN_FALSE@ sd-daemon.c \
-@DBUS_WIN_FALSE@ sd-daemon.h
+@DBUS_WIN_FALSE@ $(NULL)
@DBUS_WIN_TRUE@DBUS_SHARED_arch_sources = \
@DBUS_WIN_TRUE@ $(wince_source) \
@@ -920,8 +917,7 @@ libdbus_internal_la_CPPFLAGS = \
-DDBUS_STATIC_BUILD \
$(NULL)
-libdbus_internal_la_LIBADD = $(LIBDBUS_LIBS) $(SYSTEMD_LIBS) \
- $(am__append_4)
+libdbus_internal_la_LIBADD = $(LIBDBUS_LIBS) $(am__append_4)
@DBUS_WIN_TRUE@libdbus_init_win_la_SOURCES = dbus-init-win.cpp
test_dbus_SOURCES = \
dbus-test-main.c
@@ -1098,7 +1094,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_1_la-dbus-userdb.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_1_la-dbus-uuidgen.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_1_la-dbus-watch.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_1_la-sd-daemon.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_internal_la-dbus-address.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_internal_la-dbus-asv-util.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_internal_la-dbus-auth-script.Plo@am__quote@
@@ -1176,7 +1171,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_internal_la-dbus-userdb.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_internal_la-dbus-uuidgen.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_internal_la-dbus-watch.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_internal_la-sd-daemon.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -1535,13 +1529,6 @@ libdbus_1_la-dbus-userdb.lo: dbus-userdb.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdbus_1_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdbus_1_la-dbus-userdb.lo `test -f 'dbus-userdb.c' || echo '$(srcdir)/'`dbus-userdb.c
-libdbus_1_la-sd-daemon.lo: sd-daemon.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdbus_1_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdbus_1_la-sd-daemon.lo -MD -MP -MF $(DEPDIR)/libdbus_1_la-sd-daemon.Tpo -c -o libdbus_1_la-sd-daemon.lo `test -f 'sd-daemon.c' || echo '$(srcdir)/'`sd-daemon.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdbus_1_la-sd-daemon.Tpo $(DEPDIR)/libdbus_1_la-sd-daemon.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sd-daemon.c' object='libdbus_1_la-sd-daemon.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdbus_1_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdbus_1_la-sd-daemon.lo `test -f 'sd-daemon.c' || echo '$(srcdir)/'`sd-daemon.c
-
libdbus_1_la-dbus-sysdeps-wince-glue.lo: dbus-sysdeps-wince-glue.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdbus_1_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdbus_1_la-dbus-sysdeps-wince-glue.lo -MD -MP -MF $(DEPDIR)/libdbus_1_la-dbus-sysdeps-wince-glue.Tpo -c -o libdbus_1_la-dbus-sysdeps-wince-glue.lo `test -f 'dbus-sysdeps-wince-glue.c' || echo '$(srcdir)/'`dbus-sysdeps-wince-glue.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdbus_1_la-dbus-sysdeps-wince-glue.Tpo $(DEPDIR)/libdbus_1_la-dbus-sysdeps-wince-glue.Plo
@@ -1927,13 +1914,6 @@ libdbus_internal_la-dbus-userdb.lo: dbus-userdb.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdbus_internal_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdbus_internal_la-dbus-userdb.lo `test -f 'dbus-userdb.c' || echo '$(srcdir)/'`dbus-userdb.c
-libdbus_internal_la-sd-daemon.lo: sd-daemon.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdbus_internal_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdbus_internal_la-sd-daemon.lo -MD -MP -MF $(DEPDIR)/libdbus_internal_la-sd-daemon.Tpo -c -o libdbus_internal_la-sd-daemon.lo `test -f 'sd-daemon.c' || echo '$(srcdir)/'`sd-daemon.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdbus_internal_la-sd-daemon.Tpo $(DEPDIR)/libdbus_internal_la-sd-daemon.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sd-daemon.c' object='libdbus_internal_la-sd-daemon.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdbus_internal_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdbus_internal_la-sd-daemon.lo `test -f 'sd-daemon.c' || echo '$(srcdir)/'`sd-daemon.c
-
libdbus_internal_la-dbus-sysdeps-wince-glue.lo: dbus-sysdeps-wince-glue.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdbus_internal_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdbus_internal_la-dbus-sysdeps-wince-glue.lo -MD -MP -MF $(DEPDIR)/libdbus_internal_la-dbus-sysdeps-wince-glue.Tpo -c -o libdbus_internal_la-dbus-sysdeps-wince-glue.lo `test -f 'dbus-sysdeps-wince-glue.c' || echo '$(srcdir)/'`dbus-sysdeps-wince-glue.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdbus_internal_la-dbus-sysdeps-wince-glue.Tpo $(DEPDIR)/libdbus_internal_la-dbus-sysdeps-wince-glue.Plo
@@ -2429,10 +2409,6 @@ uninstall-am: uninstall-dbusincludeHEADERS uninstall-libLTLIBRARIES \
clean-local:
/bin/rm *.bb *.bbg *.da *.gcov .libs/*.da .libs/*.bbg || true
-update-systemd:
- curl http://cgit.freedesktop.org/systemd/systemd/plain/src/libsystemd-daemon/sd-daemon.c > $(srcdir)/sd-daemon.c
- curl http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-daemon.h > $(srcdir)/sd-daemon.h
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/dbus/dbus-errors.c b/dbus/dbus-errors.c
index a0571a50..5d8f194e 100644
--- a/dbus/dbus-errors.c
+++ b/dbus/dbus-errors.c
@@ -189,9 +189,9 @@ dbus_error_init (DBusError *error)
{
DBusRealError *real;
- _dbus_return_if_fail (error != NULL);
+ _DBUS_STATIC_ASSERT (sizeof (DBusError) == sizeof (DBusRealError));
- _dbus_assert (sizeof (DBusError) == sizeof (DBusRealError));
+ _dbus_return_if_fail (error != NULL);
real = (DBusRealError *)error;
diff --git a/dbus/dbus-hash.c b/dbus/dbus-hash.c
index c80835aa..8f7d04bb 100644
--- a/dbus/dbus-hash.c
+++ b/dbus/dbus-hash.c
@@ -519,7 +519,7 @@ _dbus_hash_iter_init (DBusHashTable *table,
{
DBusRealHashIter *real;
- _dbus_assert (sizeof (DBusHashIter) == sizeof (DBusRealHashIter));
+ _DBUS_STATIC_ASSERT (sizeof (DBusHashIter) == sizeof (DBusRealHashIter));
real = (DBusRealHashIter*) iter;
@@ -544,7 +544,7 @@ _dbus_hash_iter_next (DBusHashIter *iter)
{
DBusRealHashIter *real;
- _dbus_assert (sizeof (DBusHashIter) == sizeof (DBusRealHashIter));
+ _DBUS_STATIC_ASSERT (sizeof (DBusHashIter) == sizeof (DBusRealHashIter));
real = (DBusRealHashIter*) iter;
@@ -746,7 +746,7 @@ _dbus_hash_iter_lookup (DBusHashTable *table,
DBusHashEntry *entry;
DBusHashEntry **bucket;
- _dbus_assert (sizeof (DBusHashIter) == sizeof (DBusRealHashIter));
+ _DBUS_STATIC_ASSERT (sizeof (DBusHashIter) == sizeof (DBusRealHashIter));
real = (DBusRealHashIter*) iter;
diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c
index eafc2a9a..9bb5b761 100644
--- a/dbus/dbus-marshal-basic.c
+++ b/dbus/dbus-marshal-basic.c
@@ -599,7 +599,7 @@ marshal_2_octets (DBusString *str,
dbus_bool_t retval;
int orig_len;
- _dbus_assert (sizeof (value) == 2);
+ _DBUS_STATIC_ASSERT (sizeof (value) == 2);
if (byte_order != DBUS_COMPILER_BYTE_ORDER)
value = DBUS_UINT16_SWAP_LE_BE (value);
@@ -628,7 +628,7 @@ marshal_4_octets (DBusString *str,
dbus_bool_t retval;
int orig_len;
- _dbus_assert (sizeof (value) == 4);
+ _DBUS_STATIC_ASSERT (sizeof (value) == 4);
if (byte_order != DBUS_COMPILER_BYTE_ORDER)
value = DBUS_UINT32_SWAP_LE_BE (value);
@@ -657,7 +657,7 @@ marshal_8_octets (DBusString *str,
dbus_bool_t retval;
int orig_len;
- _dbus_assert (sizeof (value) == 8);
+ _DBUS_STATIC_ASSERT (sizeof (value) == 8);
swap_8_octets (&value, byte_order);
diff --git a/dbus/dbus-message-util.c b/dbus/dbus-message-util.c
index f615af83..5266b013 100644
--- a/dbus/dbus-message-util.c
+++ b/dbus/dbus-message-util.c
@@ -1205,6 +1205,7 @@ _dbus_message_test (const char *test_data_dir)
#endif
char **decomposed;
DBusInitialFDs *initial_fds;
+ dbus_bool_t ok;
initial_fds = _dbus_check_fdleaks_enter ();
@@ -1603,18 +1604,19 @@ _dbus_message_test (const char *test_data_dir)
dbus_message_iter_init_append (message, &iter);
- _dbus_assert (dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY,
+ ok = dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY,
(DBUS_STRUCT_BEGIN_CHAR_AS_STRING
DBUS_TYPE_STRING_AS_STRING
DBUS_TYPE_STRING_AS_STRING
DBUS_STRUCT_END_CHAR_AS_STRING),
- &array_iter));
- _dbus_assert (dbus_message_iter_open_container (&array_iter, DBUS_TYPE_STRUCT,
- NULL, &struct_iter));
-
+ &array_iter);
+ _dbus_assert (ok);
+ ok = dbus_message_iter_open_container (&array_iter, DBUS_TYPE_STRUCT,
+ NULL, &struct_iter);
+ _dbus_assert (ok);
s = "peaches";
- _dbus_assert (dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_STRING,
- &s));
+ ok = dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_STRING, &s);
+ _dbus_assert (ok);
/* uh-oh, error, try and unwind */
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 3e74fc54..974e8fa6 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -2025,7 +2025,7 @@ _dbus_message_iter_init_common (DBusMessage *message,
DBusMessageRealIter *real,
int iter_type)
{
- _dbus_assert (sizeof (DBusMessageRealIter) <= sizeof (DBusMessageIter));
+ _DBUS_STATIC_ASSERT (sizeof (DBusMessageRealIter) <= sizeof (DBusMessageIter));
/* Since the iterator will read or write who-knows-what from the
* message, we need to get in the right byte order
diff --git a/dbus/dbus-server-launchd.c b/dbus/dbus-server-launchd.c
index 9832875e..d9d5908c 100644
--- a/dbus/dbus-server-launchd.c
+++ b/dbus/dbus-server-launchd.c
@@ -42,6 +42,7 @@
#include "dbus-misc.h"
#include "dbus-server-socket.h"
+#include "dbus-sysdeps-unix.h"
/* put other private launchd functions here */
diff --git a/dbus/dbus-signature.c b/dbus/dbus-signature.c
index 8a4701c9..6f1521b1 100644
--- a/dbus/dbus-signature.c
+++ b/dbus/dbus-signature.c
@@ -428,7 +428,7 @@ _dbus_signature_test (void)
const char *sig;
dbus_bool_t boolres;
- _dbus_assert (sizeof (DBusSignatureIter) >= sizeof (DBusSignatureRealIter));
+ _DBUS_STATIC_ASSERT (sizeof (DBusSignatureIter) >= sizeof (DBusSignatureRealIter));
sig = "";
_dbus_assert (dbus_signature_validate (sig, NULL));
diff --git a/dbus/dbus-string.c b/dbus/dbus-string.c
index c4e2e7fc..15cff9c6 100644
--- a/dbus/dbus-string.c
+++ b/dbus/dbus-string.c
@@ -133,11 +133,11 @@ _dbus_string_init_preallocated (DBusString *str,
int allocate_size)
{
DBusRealString *real;
-
+
+ _DBUS_STATIC_ASSERT (sizeof (DBusString) == sizeof (DBusRealString));
+
_dbus_assert (str != NULL);
- _dbus_assert (sizeof (DBusString) == sizeof (DBusRealString));
-
real = (DBusRealString*) str;
/* It's very important not to touch anything
@@ -234,6 +234,23 @@ _dbus_string_init_const_len (DBusString *str,
}
/**
+ * Initializes a string from another string. The
+ * string must eventually be freed with _dbus_string_free().
+ *
+ * @param str memory to hold the string
+ * @param from instance from which the string is initialized
+ * @returns #TRUE on success, #FALSE if no memory
+ */
+dbus_bool_t
+_dbus_string_init_from_string(DBusString *str,
+ const DBusString *from)
+{
+ if (!_dbus_string_init (str))
+ return FALSE;
+ return _dbus_string_append (str, _dbus_string_get_const_data (from));
+}
+
+/**
* Frees a string created by _dbus_string_init().
*
* @param str memory where the string is stored.
diff --git a/dbus/dbus-string.h b/dbus/dbus-string.h
index 86fb8c39..44860feb 100644
--- a/dbus/dbus-string.h
+++ b/dbus/dbus-string.h
@@ -75,6 +75,9 @@ void _dbus_string_init_const_len (DBusString *str,
int len);
dbus_bool_t _dbus_string_init_preallocated (DBusString *str,
int allocate_size);
+
+dbus_bool_t _dbus_string_init_from_string (DBusString *str,
+ const DBusString *from);
void _dbus_string_free (DBusString *str);
void _dbus_string_lock (DBusString *str);
dbus_bool_t _dbus_string_compact (DBusString *str,
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index fe891ab7..544429a7 100644
--- a/dbus/dbus-sysdeps-unix.c
+++ b/dbus/dbus-sysdeps-unix.c
@@ -53,6 +53,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <netdb.h>
#include <grp.h>
#include <arpa/inet.h>
@@ -80,7 +81,9 @@
#include <bsm/adt.h>
#endif
-#include "sd-daemon.h"
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
#if !DBUS_USE_SYNC
#include <pthread.h>
@@ -1102,7 +1105,7 @@ _dbus_listen_unix_socket (const char *path,
if (path_len > _DBUS_MAX_SUN_PATH_LENGTH)
{
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
- "Abstract socket name too long\n");
+ "Socket name too long\n");
_dbus_close (listen_fd, NULL);
return -1;
}
@@ -1159,6 +1162,7 @@ int
_dbus_listen_systemd_sockets (int **fds,
DBusError *error)
{
+#ifdef HAVE_SYSTEMD
int r, n;
unsigned fd;
int *new_fds;
@@ -1234,6 +1238,11 @@ _dbus_listen_systemd_sockets (int **fds,
dbus_free (new_fds);
return -1;
+#else
+ dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
+ "dbus was compiled without systemd support");
+ return -1;
+#endif
}
/**
@@ -1424,7 +1433,7 @@ _dbus_listen_tcp_socket (const char *host,
tmp = ai;
while (tmp)
{
- int fd = -1, *newlisten_fd;
+ int fd = -1, *newlisten_fd, tcp_nodelay_on;
if (!_dbus_open_socket (&fd, tmp->ai_family, SOCK_STREAM, 0, error))
{
_DBUS_ASSERT_ERROR_IS_SET(error);
@@ -1439,6 +1448,15 @@ _dbus_listen_tcp_socket (const char *host,
host ? host : "*", port, _dbus_strerror (errno));
}
+ /* Nagle's algorithm imposes a huge delay on the initial messages
+ going over TCP. */
+ tcp_nodelay_on = 1;
+ if (setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &tcp_nodelay_on, sizeof (tcp_nodelay_on)) == -1)
+ {
+ _dbus_warn ("Failed to set TCP_NODELAY socket option \"%s:%s\": %s",
+ host ? host : "*", port, _dbus_strerror (errno));
+ }
+
if (bind (fd, (struct sockaddr*) tmp->ai_addr, tmp->ai_addrlen) < 0)
{
saved_errno = errno;
@@ -1679,18 +1697,18 @@ _dbus_read_credentials_socket (int client_fd,
} cmsg;
#endif
- uid_read = DBUS_UID_UNSET;
- pid_read = DBUS_PID_UNSET;
-
- _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-
/* The POSIX spec certainly doesn't promise this, but
* we need these assertions to fail as soon as we're wrong about
* it so we can do the porting fixups
*/
- _dbus_assert (sizeof (pid_t) <= sizeof (dbus_pid_t));
- _dbus_assert (sizeof (uid_t) <= sizeof (dbus_uid_t));
- _dbus_assert (sizeof (gid_t) <= sizeof (dbus_gid_t));
+ _DBUS_STATIC_ASSERT (sizeof (pid_t) <= sizeof (dbus_pid_t));
+ _DBUS_STATIC_ASSERT (sizeof (uid_t) <= sizeof (dbus_uid_t));
+ _DBUS_STATIC_ASSERT (sizeof (gid_t) <= sizeof (dbus_gid_t));
+
+ uid_read = DBUS_UID_UNSET;
+ pid_read = DBUS_PID_UNSET;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
_dbus_credentials_clear (credentials);
@@ -2371,9 +2389,9 @@ _dbus_credentials_add_from_current_process (DBusCredentials *credentials)
* we need these assertions to fail as soon as we're wrong about
* it so we can do the porting fixups
*/
- _dbus_assert (sizeof (pid_t) <= sizeof (dbus_pid_t));
- _dbus_assert (sizeof (uid_t) <= sizeof (dbus_uid_t));
- _dbus_assert (sizeof (gid_t) <= sizeof (dbus_gid_t));
+ _DBUS_STATIC_ASSERT (sizeof (pid_t) <= sizeof (dbus_pid_t));
+ _DBUS_STATIC_ASSERT (sizeof (uid_t) <= sizeof (dbus_uid_t));
+ _DBUS_STATIC_ASSERT (sizeof (gid_t) <= sizeof (dbus_gid_t));
if (!_dbus_credentials_add_pid(credentials, _dbus_getpid()))
return FALSE;
@@ -2592,6 +2610,11 @@ _dbus_poll (DBusPollFD *fds,
_DBUS_STRUCT_OFFSET (DBusPollFD, revents) ==
_DBUS_STRUCT_OFFSET (struct pollfd, revents))
{
+ if (timeout_milliseconds < -1)
+ {
+ timeout_milliseconds = -1;
+ }
+
return poll ((struct pollfd*) fds,
n_fds,
timeout_milliseconds);
@@ -2933,7 +2956,7 @@ _dbus_disable_sigpipe (void)
* @param fd the file descriptor
*/
void
-_dbus_fd_set_close_on_exec (intptr_t fd)
+_dbus_fd_set_close_on_exec (int fd)
{
int val;
@@ -3513,6 +3536,7 @@ _dbus_get_autolaunch_address (const char *scope,
* but that's done elsewhere, and if it worked, this function wouldn't
* be called.) */
const char *display;
+ char *progpath;
char *argv[6];
int i;
DBusString uuid;
@@ -3552,13 +3576,19 @@ _dbus_get_autolaunch_address (const char *scope,
goto out;
}
- i = 0;
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
if (_dbus_getenv ("DBUS_USE_TEST_BINARY") != NULL)
- argv[i] = TEST_BUS_LAUNCH_BINARY;
+ progpath = TEST_BUS_LAUNCH_BINARY;
else
#endif
- argv[i] = DBUS_BINDIR "/dbus-launch";
+ progpath = DBUS_BINDIR "/dbus-launch";
+ /*
+ * argv[0] is always dbus-launch, that's the name what we'll
+ * get from /proc, or ps(1), regardless what the progpath is,
+ * see fd.o#69716
+ */
+ i = 0;
+ argv[i] = "dbus-launch";
++i;
argv[i] = "--autolaunch";
++i;
@@ -3573,7 +3603,7 @@ _dbus_get_autolaunch_address (const char *scope,
_dbus_assert (i == _DBUS_N_ELEMENTS (argv));
- retval = _read_subprocess_line_argv (argv[0],
+ retval = _read_subprocess_line_argv (progpath,
TRUE,
argv, address, error);
diff --git a/dbus/dbus-sysdeps-unix.h b/dbus/dbus-sysdeps-unix.h
index a265b335..df9902de 100644
--- a/dbus/dbus-sysdeps-unix.h
+++ b/dbus/dbus-sysdeps-unix.h
@@ -142,6 +142,8 @@ dbus_bool_t _dbus_append_address_from_socket (int fd,
DBusString *address,
DBusError *error);
+void _dbus_fd_set_close_on_exec (int fd);
+
/** @} */
DBUS_END_DECLS
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c
index 0d8a66c7..d104e41c 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -58,7 +58,9 @@
#include <sys/syslimits.h>
#endif
-#include "sd-daemon.h"
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
#ifndef O_BINARY
#define O_BINARY 0
diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c
index 4678b11e..dd53417f 100644
--- a/dbus/dbus-sysdeps-util-win.c
+++ b/dbus/dbus-sysdeps-util-win.c
@@ -424,155 +424,15 @@ _dbus_stat(const DBusString *filename,
return TRUE;
}
-
-/* This file is part of the KDE project
-Copyright (C) 2000 Werner Almesberger
-
-libc/sys/linux/sys/dirent.h - Directory entry as returned by readdir
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public License
-along with this program; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.
-*/
-#define HAVE_NO_D_NAMLEN /* no struct dirent->d_namlen */
-#define HAVE_DD_LOCK /* have locking mechanism */
-
-#define MAXNAMLEN 255 /* sizeof(struct dirent.d_name)-1 */
-
-#define __dirfd(dir) (dir)->dd_fd
-
-/* struct dirent - same as Unix */
-struct dirent
- {
- long d_ino; /* inode (always 1 in WIN32) */
- off_t d_off; /* offset to this dirent */
- unsigned short d_reclen; /* length of d_name */
- char d_name[_MAX_FNAME+1]; /* filename (null terminated) */
- };
-
-/* typedef DIR - not the same as Unix */
-typedef struct
- {
- HANDLE handle; /* FindFirst/FindNext handle */
- short offset; /* offset into directory */
- short finished; /* 1 if there are not more files */
- WIN32_FIND_DATAA fileinfo; /* from FindFirst/FindNext */
- char *dir; /* the dir we are reading */
- struct dirent dent; /* the dirent to return */
- }
-DIR;
-
-/**********************************************************************
-* Implement dirent-style opendir/readdir/closedir on Window 95/NT
-*
-* Functions defined are opendir(), readdir() and closedir() with the
-* same prototypes as the normal dirent.h implementation.
-*
-* Does not implement telldir(), seekdir(), rewinddir() or scandir().
-* The dirent struct is compatible with Unix, except that d_ino is
-* always 1 and d_off is made up as we go along.
-*
-* Error codes are not available with errno but GetLastError.
-*
-* The DIR typedef is not compatible with Unix.
-**********************************************************************/
-
-static DIR * _dbus_opendir(const char *dir)
-{
- DIR *dp;
- char *filespec;
- HANDLE handle;
- int index;
-
- filespec = malloc(strlen(dir) + 2 + 1);
- strcpy(filespec, dir);
- index = strlen(filespec) - 1;
- if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
- filespec[index] = '\0';
- strcat(filespec, "\\*");
-
- dp = (DIR *)malloc(sizeof(DIR));
- dp->offset = 0;
- dp->finished = 0;
- dp->dir = strdup(dir);
-
- handle = FindFirstFileA(filespec, &(dp->fileinfo));
- if (handle == INVALID_HANDLE_VALUE)
- {
- if (GetLastError() == ERROR_NO_MORE_FILES)
- dp->finished = 1;
- else
- return NULL;
- }
-
- dp->handle = handle;
- free(filespec);
-
- return dp;
-}
-
-static struct dirent * _dbus_readdir(DIR *dp)
-{
- int saved_err = GetLastError();
-
- if (!dp || dp->finished)
- return NULL;
-
- if (dp->offset != 0)
- {
- if (FindNextFileA(dp->handle, &(dp->fileinfo)) == 0)
- {
- if (GetLastError() == ERROR_NO_MORE_FILES)
- {
- SetLastError(saved_err);
- dp->finished = 1;
- }
- return NULL;
- }
- }
- dp->offset++;
-
- strncpy(dp->dent.d_name, dp->fileinfo.cFileName, _MAX_FNAME);
- dp->dent.d_ino = 1;
- dp->dent.d_reclen = strlen(dp->dent.d_name);
- dp->dent.d_off = dp->offset;
-
- return &(dp->dent);
-}
-
-
-static int _dbus_closedir(DIR *dp)
-{
- if (!dp)
- return 0;
- FindClose(dp->handle);
- if (dp->dir)
- free(dp->dir);
- if (dp)
- free(dp);
-
- return 0;
-}
-
-
/**
* Internals of directory iterator
*/
struct DBusDirIter
{
- DIR *d; /**< The DIR* from opendir() */
-
+ HANDLE handle;
+ WIN32_FIND_DATAA fileinfo; /* from FindFirst/FindNext */
+ dbus_bool_t finished; /* true if there are no more entries */
+ int offset;
};
/**
@@ -586,35 +446,66 @@ DBusDirIter*
_dbus_directory_open (const DBusString *filename,
DBusError *error)
{
- DIR *d;
DBusDirIter *iter;
- const char *filename_c;
+ DBusString filespec;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
- filename_c = _dbus_string_get_const_data (filename);
-
- d = _dbus_opendir (filename_c);
- if (d == NULL)
+ if (!_dbus_string_init_from_string (&filespec, filename))
{
- char *emsg = _dbus_win_error_string (GetLastError ());
- dbus_set_error (error, _dbus_win_error_from_last_error (),
- "Failed to read directory \"%s\": %s",
- filename_c, emsg);
- _dbus_win_free_error_string (emsg);
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
+ "Could not allocate memory for directory filename copy");
return NULL;
}
+
+ if (_dbus_string_ends_with_c_str (&filespec, "/") || _dbus_string_ends_with_c_str (&filespec, "\\") )
+ {
+ if (!_dbus_string_append (&filespec, "*"))
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
+ "Could not append filename wildcard");
+ return NULL;
+ }
+ }
+ else if (!_dbus_string_ends_with_c_str (&filespec, "*"))
+ {
+ if (!_dbus_string_append (&filespec, "\\*"))
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
+ "Could not append filename wildcard 2");
+ return NULL;
+ }
+ }
+
iter = dbus_new0 (DBusDirIter, 1);
if (iter == NULL)
{
- _dbus_closedir (d);
+ _dbus_string_free (&filespec);
dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
"Could not allocate memory for directory iterator");
return NULL;
}
- iter->d = d;
-
+ iter->finished = FALSE;
+ iter->offset = 0;
+ iter->handle = FindFirstFileA (_dbus_string_get_const_data (&filespec), &(iter->fileinfo));
+ if (iter->handle == INVALID_HANDLE_VALUE)
+ {
+ if (GetLastError () == ERROR_NO_MORE_FILES)
+ iter->finished = TRUE;
+ else
+ {
+ char *emsg = _dbus_win_error_string (GetLastError ());
+ dbus_set_error (error, _dbus_win_error_from_last_error (),
+ "Failed to read directory \"%s\": %s",
+ _dbus_string_get_const_data (filename), emsg);
+ _dbus_win_free_error_string (emsg);
+ dbus_free ( iter );
+ _dbus_string_free (&filespec);
+ return NULL;
+ }
+ }
+ _dbus_string_free (&filespec);
return iter;
}
@@ -623,9 +514,6 @@ _dbus_directory_open (const DBusString *filename,
* UNIX. If an error occurs, the contents of "filename" are
* undefined. The error is never set if the function succeeds.
*
- * @todo for thread safety, I think we have to use
- * readdir_r(). (GLib has the same issue, should file a bug.)
- *
* @param iter the iterator
* @param filename string to be set to the next file in the dir
* @param error return location for error
@@ -636,40 +524,55 @@ _dbus_directory_get_next_file (DBusDirIter *iter,
DBusString *filename,
DBusError *error)
{
- struct dirent *ent;
+ int saved_err = GetLastError();
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
again:
SetLastError (0);
- ent = _dbus_readdir (iter->d);
- if (ent == NULL)
+
+ if (!iter || iter->finished)
+ return FALSE;
+
+ if (iter->offset > 0)
{
- if (GetLastError() != 0)
+ if (FindNextFileA (iter->handle, &(iter->fileinfo)) == 0)
{
- char *emsg = _dbus_win_error_string (GetLastError ());
- dbus_set_error (error, _dbus_win_error_from_last_error (),
- "Failed to get next in directory: %s", emsg);
- _dbus_win_free_error_string (emsg);
+ if (GetLastError() == ERROR_NO_MORE_FILES)
+ {
+ SetLastError(saved_err);
+ iter->finished = 1;
+ }
+ else
+ {
+ char *emsg = _dbus_win_error_string (GetLastError ());
+ dbus_set_error (error, _dbus_win_error_from_last_error (),
+ "Failed to get next in directory: %s", emsg);
+ _dbus_win_free_error_string (emsg);
+ return FALSE;
+ }
}
- return FALSE;
}
- else if (ent->d_name[0] == '.' &&
- (ent->d_name[1] == '\0' ||
- (ent->d_name[1] == '.' && ent->d_name[2] == '\0')))
- goto again;
- else
+
+ iter->offset++;
+
+ if (iter->finished)
+ return FALSE;
+
+ if (iter->fileinfo.cFileName[0] == '.' &&
+ (iter->fileinfo.cFileName[1] == '\0' ||
+ (iter->fileinfo.cFileName[1] == '.' && iter->fileinfo.cFileName[2] == '\0')))
+ goto again;
+
+ _dbus_string_set_length (filename, 0);
+ if (!_dbus_string_append (filename, iter->fileinfo.cFileName))
{
- _dbus_string_set_length (filename, 0);
- if (!_dbus_string_append (filename, ent->d_name))
- {
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
- "No memory to read directory entry");
- return FALSE;
- }
- else
- return TRUE;
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
+ "No memory to read directory entry");
+ return FALSE;
}
+
+ return TRUE;
}
/**
@@ -678,7 +581,9 @@ again:
void
_dbus_directory_close (DBusDirIter *iter)
{
- _dbus_closedir (iter->d);
+ if (!iter)
+ return;
+ FindClose(iter->handle);
dbus_free (iter);
}
diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c
index 1167e967..341db8ab 100644
--- a/dbus/dbus-sysdeps-win.c
+++ b/dbus/dbus-sysdeps-win.c
@@ -518,10 +518,10 @@ _dbus_close_socket (int fd,
* on exec. Should be called for all file
* descriptors in D-Bus code.
*
- * @param handle the Windows HANDLE
+ * @param handle the Windows HANDLE (a SOCKET is also OK)
*/
-void
-_dbus_fd_set_close_on_exec (intptr_t handle)
+static void
+_dbus_win_handle_set_close_on_exec (HANDLE handle)
{
if ( !SetHandleInformation( (HANDLE) handle,
HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE,
@@ -1605,7 +1605,8 @@ _dbus_connect_tcp_socket_with_nonce (const char *host,
}
}
- _dbus_fd_set_close_on_exec (fd);
+ /* Every SOCKET is also a HANDLE. */
+ _dbus_win_handle_set_close_on_exec ((HANDLE) fd);
if (!_dbus_set_fd_nonblocking (fd, error))
{
@@ -1803,7 +1804,7 @@ _dbus_listen_tcp_socket (const char *host,
for (i = 0 ; i < nlisten_fd ; i++)
{
- _dbus_fd_set_close_on_exec (listen_fd[i]);
+ _dbus_win_handle_set_close_on_exec ((HANDLE) listen_fd[i]);
if (!_dbus_set_fd_nonblocking (listen_fd[i], error))
{
goto failed;
diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h
index 47ba2f43..955ba9aa 100644
--- a/dbus/dbus-sysdeps.h
+++ b/dbus/dbus-sysdeps.h
@@ -359,8 +359,6 @@ void _dbus_directory_close (DBusDirIter *iter);
dbus_bool_t _dbus_check_dir_is_private_to_user (DBusString *dir,
DBusError *error);
-void _dbus_fd_set_close_on_exec (intptr_t fd);
-
const char* _dbus_get_tmpdir (void);
/**
diff --git a/dbus/sd-daemon.c b/dbus/sd-daemon.c
deleted file mode 100644
index 485b3010..00000000
--- a/dbus/sd-daemon.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- Copyright 2010 Lennart Poettering
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation files
- (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-***/
-
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <limits.h>
-
-#if defined(__linux__) && !defined(SD_DAEMON_DISABLE_MQ)
-# include <mqueue.h>
-#endif
-
-#include "sd-daemon.h"
-
-#if (__GNUC__ >= 4)
-# ifdef SD_EXPORT_SYMBOLS
-/* Export symbols */
-# define _sd_export_ __attribute__ ((visibility("default")))
-# else
-/* Don't export the symbols */
-# define _sd_export_ __attribute__ ((visibility("hidden")))
-# endif
-#else
-# define _sd_export_
-#endif
-
-_sd_export_ int sd_listen_fds(int unset_environment) {
-
-#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
- return 0;
-#else
- int r, fd;
- const char *e;
- char *p = NULL;
- unsigned long l;
-
- e = getenv("LISTEN_PID");
- if (!e) {
- r = 0;
- goto finish;
- }
-
- errno = 0;
- l = strtoul(e, &p, 10);
-
- if (errno > 0) {
- r = -errno;
- goto finish;
- }
-
- if (!p || p == e || *p || l <= 0) {
- r = -EINVAL;
- goto finish;
- }
-
- /* Is this for us? */
- if (getpid() != (pid_t) l) {
- r = 0;
- goto finish;
- }
-
- e = getenv("LISTEN_FDS");
- if (!e) {
- r = 0;
- goto finish;
- }
-
- errno = 0;
- l = strtoul(e, &p, 10);
-
- if (errno > 0) {
- r = -errno;
- goto finish;
- }
-
- if (!p || p == e || *p) {
- r = -EINVAL;
- goto finish;
- }
-
- for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
- int flags;
-
- flags = fcntl(fd, F_GETFD);
- if (flags < 0) {
- r = -errno;
- goto finish;
- }
-
- if (flags & FD_CLOEXEC)
- continue;
-
- if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
- r = -errno;
- goto finish;
- }
- }
-
- r = (int) l;
-
-finish:
- if (unset_environment) {
- unsetenv("LISTEN_PID");
- unsetenv("LISTEN_FDS");
- }
-
- return r;
-#endif
-}
-
-_sd_export_ int sd_is_fifo(int fd, const char *path) {
- struct stat st_fd;
-
- if (fd < 0)
- return -EINVAL;
-
- if (fstat(fd, &st_fd) < 0)
- return -errno;
-
- if (!S_ISFIFO(st_fd.st_mode))
- return 0;
-
- if (path) {
- struct stat st_path;
-
- if (stat(path, &st_path) < 0) {
-
- if (errno == ENOENT || errno == ENOTDIR)
- return 0;
-
- return -errno;
- }
-
- return
- st_path.st_dev == st_fd.st_dev &&
- st_path.st_ino == st_fd.st_ino;
- }
-
- return 1;
-}
-
-_sd_export_ int sd_is_special(int fd, const char *path) {
- struct stat st_fd;
-
- if (fd < 0)
- return -EINVAL;
-
- if (fstat(fd, &st_fd) < 0)
- return -errno;
-
- if (!S_ISREG(st_fd.st_mode) && !S_ISCHR(st_fd.st_mode))
- return 0;
-
- if (path) {
- struct stat st_path;
-
- if (stat(path, &st_path) < 0) {
-
- if (errno == ENOENT || errno == ENOTDIR)
- return 0;
-
- return -errno;
- }
-
- if (S_ISREG(st_fd.st_mode) && S_ISREG(st_path.st_mode))
- return
- st_path.st_dev == st_fd.st_dev &&
- st_path.st_ino == st_fd.st_ino;
- else if (S_ISCHR(st_fd.st_mode) && S_ISCHR(st_path.st_mode))
- return st_path.st_rdev == st_fd.st_rdev;
- else
- return 0;
- }
-
- return 1;
-}
-
-static int sd_is_socket_internal(int fd, int type, int listening) {
- struct stat st_fd;
-
- if (fd < 0 || type < 0)
- return -EINVAL;
-
- if (fstat(fd, &st_fd) < 0)
- return -errno;
-
- if (!S_ISSOCK(st_fd.st_mode))
- return 0;
-
- if (type != 0) {
- int other_type = 0;
- socklen_t l = sizeof(other_type);
-
- if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0)
- return -errno;
-
- if (l != sizeof(other_type))
- return -EINVAL;
-
- if (other_type != type)
- return 0;
- }
-
- if (listening >= 0) {
- int accepting = 0;
- socklen_t l = sizeof(accepting);
-
- if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0)
- return -errno;
-
- if (l != sizeof(accepting))
- return -EINVAL;
-
- if (!accepting != !listening)
- return 0;
- }
-
- return 1;
-}
-
-union sockaddr_union {
- struct sockaddr sa;
- struct sockaddr_in in4;
- struct sockaddr_in6 in6;
- struct sockaddr_un un;
- struct sockaddr_storage storage;
-};
-
-_sd_export_ int sd_is_socket(int fd, int family, int type, int listening) {
- int r;
-
- if (family < 0)
- return -EINVAL;
-
- r = sd_is_socket_internal(fd, type, listening);
- if (r <= 0)
- return r;
-
- if (family > 0) {
- union sockaddr_union sockaddr = {};
- socklen_t l = sizeof(sockaddr);
-
- if (getsockname(fd, &sockaddr.sa, &l) < 0)
- return -errno;
-
- if (l < sizeof(sa_family_t))
- return -EINVAL;
-
- return sockaddr.sa.sa_family == family;
- }
-
- return 1;
-}
-
-_sd_export_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) {
- union sockaddr_union sockaddr = {};
- socklen_t l = sizeof(sockaddr);
- int r;
-
- if (family != 0 && family != AF_INET && family != AF_INET6)
- return -EINVAL;
-
- r = sd_is_socket_internal(fd, type, listening);
- if (r <= 0)
- return r;
-
- if (getsockname(fd, &sockaddr.sa, &l) < 0)
- return -errno;
-
- if (l < sizeof(sa_family_t))
- return -EINVAL;
-
- if (sockaddr.sa.sa_family != AF_INET &&
- sockaddr.sa.sa_family != AF_INET6)
- return 0;
-
- if (family > 0)
- if (sockaddr.sa.sa_family != family)
- return 0;
-
- if (port > 0) {
- if (sockaddr.sa.sa_family == AF_INET) {
- if (l < sizeof(struct sockaddr_in))
- return -EINVAL;
-
- return htons(port) == sockaddr.in4.sin_port;
- } else {
- if (l < sizeof(struct sockaddr_in6))
- return -EINVAL;
-
- return htons(port) == sockaddr.in6.sin6_port;
- }
- }
-
- return 1;
-}
-
-_sd_export_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) {
- union sockaddr_union sockaddr = {};
- socklen_t l = sizeof(sockaddr);
- int r;
-
- r = sd_is_socket_internal(fd, type, listening);
- if (r <= 0)
- return r;
-
- if (getsockname(fd, &sockaddr.sa, &l) < 0)
- return -errno;
-
- if (l < sizeof(sa_family_t))
- return -EINVAL;
-
- if (sockaddr.sa.sa_family != AF_UNIX)
- return 0;
-
- if (path) {
- if (length == 0)
- length = strlen(path);
-
- if (length == 0)
- /* Unnamed socket */
- return l == offsetof(struct sockaddr_un, sun_path);
-
- if (path[0])
- /* Normal path socket */
- return
- (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) &&
- memcmp(path, sockaddr.un.sun_path, length+1) == 0;
- else
- /* Abstract namespace socket */
- return
- (l == offsetof(struct sockaddr_un, sun_path) + length) &&
- memcmp(path, sockaddr.un.sun_path, length) == 0;
- }
-
- return 1;
-}
-
-_sd_export_ int sd_is_mq(int fd, const char *path) {
-#if !defined(__linux__) || defined(SD_DAEMON_DISABLE_MQ)
- return 0;
-#else
- struct mq_attr attr;
-
- if (fd < 0)
- return -EINVAL;
-
- if (mq_getattr(fd, &attr) < 0)
- return -errno;
-
- if (path) {
- char fpath[PATH_MAX];
- struct stat a, b;
-
- if (path[0] != '/')
- return -EINVAL;
-
- if (fstat(fd, &a) < 0)
- return -errno;
-
- strncpy(stpcpy(fpath, "/dev/mqueue"), path, sizeof(fpath) - 12);
- fpath[sizeof(fpath)-1] = 0;
-
- if (stat(fpath, &b) < 0)
- return -errno;
-
- if (a.st_dev != b.st_dev ||
- a.st_ino != b.st_ino)
- return 0;
- }
-
- return 1;
-#endif
-}
-
-_sd_export_ int sd_notify(int unset_environment, const char *state) {
-#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC)
- return 0;
-#else
- int fd = -1, r;
- struct msghdr msghdr;
- struct iovec iovec;
- union sockaddr_union sockaddr;
- const char *e;
-
- if (!state) {
- r = -EINVAL;
- goto finish;
- }
-
- e = getenv("NOTIFY_SOCKET");
- if (!e)
- return 0;
-
- /* Must be an abstract socket, or an absolute path */
- if ((e[0] != '@' && e[0] != '/') || e[1] == 0) {
- r = -EINVAL;
- goto finish;
- }
-
- fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
- if (fd < 0) {
- r = -errno;
- goto finish;
- }
-
- memset(&sockaddr, 0, sizeof(sockaddr));
- sockaddr.sa.sa_family = AF_UNIX;
- strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
-
- if (sockaddr.un.sun_path[0] == '@')
- sockaddr.un.sun_path[0] = 0;
-
- memset(&iovec, 0, sizeof(iovec));
- iovec.iov_base = (char*) state;
- iovec.iov_len = strlen(state);
-
- memset(&msghdr, 0, sizeof(msghdr));
- msghdr.msg_name = &sockaddr;
- msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e);
-
- if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
- msghdr.msg_namelen = sizeof(struct sockaddr_un);
-
- msghdr.msg_iov = &iovec;
- msghdr.msg_iovlen = 1;
-
- if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
- r = -errno;
- goto finish;
- }
-
- r = 1;
-
-finish:
- if (unset_environment)
- unsetenv("NOTIFY_SOCKET");
-
- if (fd >= 0)
- close(fd);
-
- return r;
-#endif
-}
-
-_sd_export_ int sd_notifyf(int unset_environment, const char *format, ...) {
-#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
- return 0;
-#else
- va_list ap;
- char *p = NULL;
- int r;
-
- va_start(ap, format);
- r = vasprintf(&p, format, ap);
- va_end(ap);
-
- if (r < 0 || !p)
- return -ENOMEM;
-
- r = sd_notify(unset_environment, p);
- free(p);
-
- return r;
-#endif
-}
-
-_sd_export_ int sd_booted(void) {
-#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
- return 0;
-#else
- struct stat st;
-
- /* We test whether the runtime unit file directory has been
- * created. This takes place in mount-setup.c, so is
- * guaranteed to happen very early during boot. */
-
- if (lstat("/run/systemd/system/", &st) < 0)
- return 0;
-
- return !!S_ISDIR(st.st_mode);
-#endif
-}
diff --git a/dbus/sd-daemon.h b/dbus/sd-daemon.h
deleted file mode 100644
index fb7456d5..00000000
--- a/dbus/sd-daemon.h
+++ /dev/null
@@ -1,282 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#ifndef foosddaemonhfoo
-#define foosddaemonhfoo
-
-/***
- Copyright 2010 Lennart Poettering
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation files
- (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-***/
-
-#include <sys/types.h>
-#include <inttypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- Reference implementation of a few systemd related interfaces for
- writing daemons. These interfaces are trivial to implement. To
- simplify porting we provide this reference implementation.
- Applications are welcome to reimplement the algorithms described
- here if they do not want to include these two source files.
-
- The following functionality is provided:
-
- - Support for logging with log levels on stderr
- - File descriptor passing for socket-based activation
- - Daemon startup and status notification
- - Detection of systemd boots
-
- You may compile this with -DDISABLE_SYSTEMD to disable systemd
- support. This makes all those calls NOPs that are directly related to
- systemd (i.e. only sd_is_xxx() will stay useful).
-
- Since this is drop-in code we don't want any of our symbols to be
- exported in any case. Hence we declare hidden visibility for all of
- them.
-
- You may find an up-to-date version of these source files online:
-
- http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-daemon.h
- http://cgit.freedesktop.org/systemd/systemd/plain/src/libsystemd-daemon/sd-daemon.c
-
- This should compile on non-Linux systems, too, but with the
- exception of the sd_is_xxx() calls all functions will become NOPs.
-
- See sd-daemon(3) for more information.
-*/
-
-#ifndef _sd_printf_attr_
-#if __GNUC__ >= 4
-#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
-#else
-#define _sd_printf_attr_(a,b)
-#endif
-#endif
-
-/*
- Log levels for usage on stderr:
-
- fprintf(stderr, SD_NOTICE "Hello World!\n");
-
- This is similar to printk() usage in the kernel.
-*/
-#define SD_EMERG "<0>" /* system is unusable */
-#define SD_ALERT "<1>" /* action must be taken immediately */
-#define SD_CRIT "<2>" /* critical conditions */
-#define SD_ERR "<3>" /* error conditions */
-#define SD_WARNING "<4>" /* warning conditions */
-#define SD_NOTICE "<5>" /* normal but significant condition */
-#define SD_INFO "<6>" /* informational */
-#define SD_DEBUG "<7>" /* debug-level messages */
-
-/* The first passed file descriptor is fd 3 */
-#define SD_LISTEN_FDS_START 3
-
-/*
- Returns how many file descriptors have been passed, or a negative
- errno code on failure. Optionally, removes the $LISTEN_FDS and
- $LISTEN_PID file descriptors from the environment (recommended, but
- problematic in threaded environments). If r is the return value of
- this function you'll find the file descriptors passed as fds
- SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative
- errno style error code on failure. This function call ensures that
- the FD_CLOEXEC flag is set for the passed file descriptors, to make
- sure they are not passed on to child processes. If FD_CLOEXEC shall
- not be set, the caller needs to unset it after this call for all file
- descriptors that are used.
-
- See sd_listen_fds(3) for more information.
-*/
-int sd_listen_fds(int unset_environment);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is a FIFO in the file system stored under the
- specified path, 0 otherwise. If path is NULL a path name check will
- not be done and the call only verifies if the file descriptor
- refers to a FIFO. Returns a negative errno style error code on
- failure.
-
- See sd_is_fifo(3) for more information.
-*/
-int sd_is_fifo(int fd, const char *path);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is a special character device on the file
- system stored under the specified path, 0 otherwise.
- If path is NULL a path name check will not be done and the call
- only verifies if the file descriptor refers to a special character.
- Returns a negative errno style error code on failure.
-
- See sd_is_special(3) for more information.
-*/
-int sd_is_special(int fd, const char *path);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is a socket of the specified family (AF_INET,
- ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If
- family is 0 a socket family check will not be done. If type is 0 a
- socket type check will not be done and the call only verifies if
- the file descriptor refers to a socket. If listening is > 0 it is
- verified that the socket is in listening mode. (i.e. listen() has
- been called) If listening is == 0 it is verified that the socket is
- not in listening mode. If listening is < 0 no listening mode check
- is done. Returns a negative errno style error code on failure.
-
- See sd_is_socket(3) for more information.
-*/
-int sd_is_socket(int fd, int family, int type, int listening);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is an Internet socket, of the specified family
- (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM,
- SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version
- check is not done. If type is 0 a socket type check will not be
- done. If port is 0 a socket port check will not be done. The
- listening flag is used the same way as in sd_is_socket(). Returns a
- negative errno style error code on failure.
-
- See sd_is_socket_inet(3) for more information.
-*/
-int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is an AF_UNIX socket of the specified type
- (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0
- a socket type check will not be done. If path is NULL a socket path
- check will not be done. For normal AF_UNIX sockets set length to
- 0. For abstract namespace sockets set length to the length of the
- socket name (including the initial 0 byte), and pass the full
- socket path in path (including the initial 0 byte). The listening
- flag is used the same way as in sd_is_socket(). Returns a negative
- errno style error code on failure.
-
- See sd_is_socket_unix(3) for more information.
-*/
-int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length);
-
-/*
- Helper call for identifying a passed file descriptor. Returns 1 if
- the file descriptor is a POSIX Message Queue of the specified name,
- 0 otherwise. If path is NULL a message queue name check is not
- done. Returns a negative errno style error code on failure.
-*/
-int sd_is_mq(int fd, const char *path);
-
-/*
- Informs systemd about changed daemon state. This takes a number of
- newline separated environment-style variable assignments in a
- string. The following variables are known:
-
- READY=1 Tells systemd that daemon startup is finished (only
- relevant for services of Type=notify). The passed
- argument is a boolean "1" or "0". Since there is
- little value in signaling non-readiness the only
- value daemons should send is "READY=1".
-
- STATUS=... Passes a single-line status string back to systemd
- that describes the daemon state. This is free-from
- and can be used for various purposes: general state
- feedback, fsck-like programs could pass completion
- percentages and failing programs could pass a human
- readable error message. Example: "STATUS=Completed
- 66% of file system check..."
-
- ERRNO=... If a daemon fails, the errno-style error code,
- formatted as string. Example: "ERRNO=2" for ENOENT.
-
- BUSERROR=... If a daemon fails, the D-Bus error-style error
- code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut"
-
- MAINPID=... The main pid of a daemon, in case systemd did not
- fork off the process itself. Example: "MAINPID=4711"
-
- WATCHDOG=1 Tells systemd to update the watchdog timestamp.
- Services using this feature should do this in
- regular intervals. A watchdog framework can use the
- timestamps to detect failed services.
-
- Daemons can choose to send additional variables. However, it is
- recommended to prefix variable names not listed above with X_.
-
- Returns a negative errno-style error code on failure. Returns > 0
- if systemd could be notified, 0 if it couldn't possibly because
- systemd is not running.
-
- Example: When a daemon finished starting up, it could issue this
- call to notify systemd about it:
-
- sd_notify(0, "READY=1");
-
- See sd_notifyf() for more complete examples.
-
- See sd_notify(3) for more information.
-*/
-int sd_notify(int unset_environment, const char *state);
-
-/*
- Similar to sd_notify() but takes a format string.
-
- Example 1: A daemon could send the following after initialization:
-
- sd_notifyf(0, "READY=1\n"
- "STATUS=Processing requests...\n"
- "MAINPID=%lu",
- (unsigned long) getpid());
-
- Example 2: A daemon could send the following shortly before
- exiting, on failure:
-
- sd_notifyf(0, "STATUS=Failed to start up: %s\n"
- "ERRNO=%i",
- strerror(errno),
- errno);
-
- See sd_notifyf(3) for more information.
-*/
-int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3);
-
-/*
- Returns > 0 if the system was booted with systemd. Returns < 0 on
- error. Returns 0 if the system was not booted with systemd. Note
- that all of the functions above handle non-systemd boots just
- fine. You should NOT protect them with a call to this function. Also
- note that this function checks whether the system, not the user
- session is controlled by systemd. However the functions above work
- for both user and system services.
-
- See sd_booted(3) for more information.
-*/
-int sd_booted(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/doc/dbus-launch.1.xml.in b/doc/dbus-launch.1.xml.in
index 31dd6eac..5135d9ca 100644
--- a/doc/dbus-launch.1.xml.in
+++ b/doc/dbus-launch.1.xml.in
@@ -106,7 +106,7 @@ run by your X session, such as
or
<filename>~/.Xclients</filename>.</para>
-<para>To start a D-Bus session within a text\(hymode session,
+<para>To start a D-Bus session within a text-mode session,
do not use <emphasis remap='B'>dbus-launch</emphasis>.
Instead, see <citerefentry><refentrytitle>dbus-run-session</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para>
diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml
index f6b02152..eea5eada 100644
--- a/doc/dbus-specification.xml
+++ b/doc/dbus-specification.xml
@@ -6,8 +6,8 @@
<article id="index">
<articleinfo>
<title>D-Bus Specification</title>
- <releaseinfo>Version 0.23</releaseinfo>
- <date>2014-01-06</date>
+ <releaseinfo>Version 0.24</releaseinfo>
+ <date>2014-10-01</date>
<authorgroup>
<author>
<firstname>Havoc</firstname>
@@ -71,6 +71,15 @@
</authorgroup>
<revhistory>
<revision>
+ <revnumber>0.24</revnumber>
+ <date>2014-10-01</date>
+ <authorinitials>SMcV</authorinitials>
+ <revremark>
+ non-method-calls never expect a reply even without NO_REPLY_EXPECTED;
+ document how to quote match rules
+ </revremark>
+ </revision>
+ <revision>
<revnumber>0.23</revnumber>
<date>2014-01-06</date>
<authorinitials>SMcV, CY</authorinitials>
@@ -1292,7 +1301,8 @@
<row>
<entry><literal>METHOD_CALL</literal></entry>
<entry>1</entry>
- <entry>Method call.</entry>
+ <entry>Method call. This message type may prompt a
+ reply.</entry>
</row>
<row>
<entry><literal>METHOD_RETURN</literal></entry>
@@ -1329,11 +1339,26 @@
<row>
<entry><literal>NO_REPLY_EXPECTED</literal></entry>
<entry>0x1</entry>
- <entry>This message does not expect method return replies or
- error replies; the reply can be omitted as an
- optimization. However, it is compliant with this specification
- to return the reply despite this flag and the only harm
- from doing so is extra network traffic.
+ <entry>
+ <para>
+ This message does not expect method return replies or
+ error replies, even if it is of a type that can
+ have a reply; the reply can be omitted as an
+ optimization. It is compliant with this specification
+ to return the reply despite this flag, although doing
+ so on a bus with a non-trivial security policy
+ (such as the well-known system bus) may result in
+ access denial messages being logged for the reply.
+ </para>
+ <para>
+ Note that METHOD_CALL is the only message type currently
+ defined in this specification that can expect a reply,
+ so the presence or absence of this flag in the other
+ three message types that are currently
+ documented is meaningless: replies to those message
+ types should not be sent, whether this flag is present
+ or not.
+ </para>
</entry>
</row>
<row>
@@ -4423,7 +4448,9 @@
<literal>DESTINATION</literal> field is absent, it is considered to
be a <firstterm>broadcast signal</firstterm>, and is sent to all
applications with <firstterm>message matching rules</firstterm> that
- match the message. Most signal messages are broadcasts.
+ match the message. Most signal messages are broadcasts, and
+ no other message types currently defined in this specification
+ may be broadcast.
</para>
<para>
@@ -4463,7 +4490,7 @@
<para>
Message bus implementations may impose a security policy which
prevents certain messages from being sent or received.
- When a message cannot be sent or received due to a security
+ When a method call message cannot be sent or received due to a security
policy, the message bus should send an error reply, unless the
original message had the <literal>NO_REPLY</literal> flag.
</para>
@@ -4533,6 +4560,32 @@
"type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='Foo',path='/bar/foo',destination=':452345.34',arg2='bar'"
</para>
<para>
+ Within single quotes (ASCII apostrophe, U+0027), a backslash
+ (U+005C) represents itself, and an apostrophe ends the quoted
+ section. Outside single quotes, \' (backslash, apostrophe)
+ represents an apostrophe, and any backslash not followed by
+ an apostrophe represents itself. For instance, the match rules
+ <literal>arg0=''\''',arg1='\',arg2=',',arg3='\\'</literal> and
+ <literal>arg0=\',arg1=\,arg2=',',arg3=\\</literal>
+ both match messages where the arguments are a 1-character string
+ containing an apostrophe, a 1-character string containing a
+ backslash, a 1-character string containing a comma, and a
+ 2-character string containing two backslashes<footnote>
+ <para>
+ This idiosyncratic quoting style is based on the rules for
+ escaping items to appear inside single-quoted strings
+ in POSIX <literal>/bin/sh</literal>, but please
+ note that backslashes that are not inside single quotes have
+ different behaviour. This syntax does not offer any way to
+ represent an apostrophe inside single quotes (it is necessary
+ to leave the single-quoted section, backslash-escape the
+ apostrophe and re-enter single quotes), or to represent a
+ comma outside single quotes (it is necessary to wrap it in
+ a single-quoted section).
+ </para>
+ </footnote>.
+ </para>
+ <para>
The following table describes the keys that can be used to create
a match rule.
<informaltable>
diff --git a/doc/dbus-tutorial.xml b/doc/dbus-tutorial.xml
index c7580d15..3d14e5f7 100644
--- a/doc/dbus-tutorial.xml
+++ b/doc/dbus-tutorial.xml
@@ -882,7 +882,7 @@
<row>
<entry><literal>ay</literal></entry>
<entry>Array of bytes</entry>
- <entry><literal>DBUS_TYPE_G_BYTE_ARRAY</literal></entry>
+ <entry><literal>DBUS_TYPE_G_UCHAR_ARRAY</literal></entry>
<entry><literal>GArray *</literal></entry>
<entry>g_array_free</entry>
<entry></entry>
diff --git a/test/Makefile.am b/test/Makefile.am
index cec5cdab..1ceb5b68 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -75,12 +75,12 @@ TEST_BINARIES = \
## since they depend on stuff from this directory
TESTS = \
../bus/test-bus$(EXEEXT) \
- ../bus/test-bus-system$(EXEEXT) \
../dbus/test-dbus$(EXEEXT) \
$(NULL)
if DBUS_UNIX
TESTS += ../bus/test-bus-launch-helper$(EXEEXT)
+TESTS += ../bus/test-bus-system$(EXEEXT)
endif
else !DBUS_ENABLE_EMBEDDED_TESTS
@@ -119,6 +119,10 @@ test_syslog_SOURCES = internals/syslog.c
test_syslog_CPPFLAGS = $(static_cppflags)
test_syslog_LDADD = libdbus-testutils-internal.la $(GLIB_LIBS)
+manual_dir_iter_SOURCES = manual-dir-iter.c
+manual_dir_iter_CPPFLAGS = $(static_cppflags)
+manual_dir_iter_LDADD = $(top_builddir)/dbus/libdbus-internal.la
+
EXTRA_DIST = dbus-test-runner
testexecdir = $(libdir)/dbus-1.0/test
@@ -130,6 +134,7 @@ installable_tests = \
test-printf \
$(NULL)
installable_manual_tests = \
+ manual-dir-iter \
$(NULL)
if DBUS_WITH_GLIB
diff --git a/test/Makefile.in b/test/Makefile.in
index d8fc34a2..46b8c095 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -87,11 +87,11 @@ host_triplet = @host@
@DBUS_WITH_DBUS_GLIB_TRUE@am__append_1 = libdbus-testutils.la
@DBUS_ENABLE_EMBEDDED_TESTS_FALSE@TESTS = $(am__EXEEXT_8)
@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@TESTS = ../bus/test-bus$(EXEEXT) \
-@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@ ../bus/test-bus-system$(EXEEXT) \
@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@ ../dbus/test-dbus$(EXEEXT) \
@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@ $(am__append_2) \
@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@ $(am__EXEEXT_8)
-@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@am__append_2 = ../bus/test-bus-launch-helper$(EXEEXT)
+@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@am__append_2 = ../bus/test-bus-launch-helper$(EXEEXT) \
+@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@ ../bus/test-bus-system$(EXEEXT)
noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_6)
testexec_PROGRAMS = $(am__EXEEXT_7)
@DBUS_WITH_GLIB_TRUE@am__append_3 = \
@@ -169,7 +169,7 @@ libdbus_testutils_la_OBJECTS = $(am_libdbus_testutils_la_OBJECTS)
am__EXEEXT_3 = test-shell$(EXEEXT) test-printf$(EXEEXT) \
$(am__EXEEXT_2)
@DBUS_WITH_GLIB_TRUE@am__EXEEXT_4 = manual-authz$(EXEEXT)
-am__EXEEXT_5 = $(am__EXEEXT_4)
+am__EXEEXT_5 = manual-dir-iter$(EXEEXT) $(am__EXEEXT_4)
@DBUS_ENABLE_INSTALLED_TESTS_FALSE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_6 = $(am__EXEEXT_3) \
@DBUS_ENABLE_INSTALLED_TESTS_FALSE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@ $(am__EXEEXT_5)
@DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_7 = $(am__EXEEXT_3) \
@@ -180,6 +180,11 @@ am_manual_authz_OBJECTS = manual_authz-manual-authz.$(OBJEXT)
manual_authz_OBJECTS = $(am_manual_authz_OBJECTS)
manual_authz_DEPENDENCIES = $(testutils_shared_if_possible_libs) \
$(am__DEPENDENCIES_1)
+am_manual_dir_iter_OBJECTS = \
+ manual_dir_iter-manual-dir-iter.$(OBJEXT)
+manual_dir_iter_OBJECTS = $(am_manual_dir_iter_OBJECTS)
+manual_dir_iter_DEPENDENCIES = \
+ $(top_builddir)/dbus/libdbus-internal.la
am_test_corrupt_OBJECTS = test_corrupt-corrupt.$(OBJEXT)
test_corrupt_OBJECTS = $(am_test_corrupt_OBJECTS)
test_corrupt_DEPENDENCIES = $(testutils_shared_if_possible_libs) \
@@ -282,7 +287,8 @@ am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libdbus_testutils_internal_la_SOURCES) \
$(libdbus_testutils_la_SOURCES) $(manual_authz_SOURCES) \
- $(test_corrupt_SOURCES) $(test_dbus_daemon_SOURCES) \
+ $(manual_dir_iter_SOURCES) $(test_corrupt_SOURCES) \
+ $(test_dbus_daemon_SOURCES) \
$(test_dbus_daemon_eavesdrop_SOURCES) test-exit.c \
$(test_loopback_SOURCES) $(test_marshal_SOURCES) test-names.c \
$(test_printf_SOURCES) $(test_refs_SOURCES) \
@@ -292,8 +298,8 @@ SOURCES = $(libdbus_testutils_internal_la_SOURCES) \
$(test_syntax_SOURCES) $(test_syslog_SOURCES)
DIST_SOURCES = $(libdbus_testutils_internal_la_SOURCES) \
$(am__libdbus_testutils_la_SOURCES_DIST) \
- $(manual_authz_SOURCES) $(test_corrupt_SOURCES) \
- $(test_dbus_daemon_SOURCES) \
+ $(manual_authz_SOURCES) $(manual_dir_iter_SOURCES) \
+ $(test_corrupt_SOURCES) $(test_dbus_daemon_SOURCES) \
$(test_dbus_daemon_eavesdrop_SOURCES) test-exit.c \
$(test_loopback_SOURCES) $(test_marshal_SOURCES) test-names.c \
$(test_printf_SOURCES) $(test_refs_SOURCES) \
@@ -860,10 +866,13 @@ test_refs_LDADD = libdbus-testutils-internal.la $(GLIB_LIBS)
test_syslog_SOURCES = internals/syslog.c
test_syslog_CPPFLAGS = $(static_cppflags)
test_syslog_LDADD = libdbus-testutils-internal.la $(GLIB_LIBS)
+manual_dir_iter_SOURCES = manual-dir-iter.c
+manual_dir_iter_CPPFLAGS = $(static_cppflags)
+manual_dir_iter_LDADD = $(top_builddir)/dbus/libdbus-internal.la
EXTRA_DIST = dbus-test-runner $(in_data) $(static_data)
testexecdir = $(libdir)/dbus-1.0/test
installable_tests = test-shell test-printf $(NULL) $(am__append_3)
-installable_manual_tests = $(NULL) $(am__append_4)
+installable_manual_tests = manual-dir-iter $(NULL) $(am__append_4)
installcheck_tests = $(am__append_6)
installcheck_environment = \
XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \
@@ -1148,6 +1157,10 @@ manual-authz$(EXEEXT): $(manual_authz_OBJECTS) $(manual_authz_DEPENDENCIES) $(EX
@rm -f manual-authz$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(manual_authz_OBJECTS) $(manual_authz_LDADD) $(LIBS)
+manual-dir-iter$(EXEEXT): $(manual_dir_iter_OBJECTS) $(manual_dir_iter_DEPENDENCIES) $(EXTRA_manual_dir_iter_DEPENDENCIES)
+ @rm -f manual-dir-iter$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(manual_dir_iter_OBJECTS) $(manual_dir_iter_LDADD) $(LIBS)
+
test-corrupt$(EXEEXT): $(test_corrupt_OBJECTS) $(test_corrupt_DEPENDENCIES) $(EXTRA_test_corrupt_DEPENDENCIES)
@rm -f test-corrupt$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_corrupt_OBJECTS) $(test_corrupt_LDADD) $(LIBS)
@@ -1228,6 +1241,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_testutils_internal_la-test-utils.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manual_authz-manual-authz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manual_dir_iter-manual-dir-iter.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/marshal.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syntax.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-exit.Po@am__quote@
@@ -1290,6 +1304,20 @@ manual_authz-manual-authz.obj: manual-authz.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_authz_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o manual_authz-manual-authz.obj `if test -f 'manual-authz.c'; then $(CYGPATH_W) 'manual-authz.c'; else $(CYGPATH_W) '$(srcdir)/manual-authz.c'; fi`
+manual_dir_iter-manual-dir-iter.o: manual-dir-iter.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_dir_iter_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT manual_dir_iter-manual-dir-iter.o -MD -MP -MF $(DEPDIR)/manual_dir_iter-manual-dir-iter.Tpo -c -o manual_dir_iter-manual-dir-iter.o `test -f 'manual-dir-iter.c' || echo '$(srcdir)/'`manual-dir-iter.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/manual_dir_iter-manual-dir-iter.Tpo $(DEPDIR)/manual_dir_iter-manual-dir-iter.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='manual-dir-iter.c' object='manual_dir_iter-manual-dir-iter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_dir_iter_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o manual_dir_iter-manual-dir-iter.o `test -f 'manual-dir-iter.c' || echo '$(srcdir)/'`manual-dir-iter.c
+
+manual_dir_iter-manual-dir-iter.obj: manual-dir-iter.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_dir_iter_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT manual_dir_iter-manual-dir-iter.obj -MD -MP -MF $(DEPDIR)/manual_dir_iter-manual-dir-iter.Tpo -c -o manual_dir_iter-manual-dir-iter.obj `if test -f 'manual-dir-iter.c'; then $(CYGPATH_W) 'manual-dir-iter.c'; else $(CYGPATH_W) '$(srcdir)/manual-dir-iter.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/manual_dir_iter-manual-dir-iter.Tpo $(DEPDIR)/manual_dir_iter-manual-dir-iter.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='manual-dir-iter.c' object='manual_dir_iter-manual-dir-iter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_dir_iter_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o manual_dir_iter-manual-dir-iter.obj `if test -f 'manual-dir-iter.c'; then $(CYGPATH_W) 'manual-dir-iter.c'; else $(CYGPATH_W) '$(srcdir)/manual-dir-iter.c'; fi`
+
test_corrupt-corrupt.o: corrupt.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_corrupt_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_corrupt-corrupt.o -MD -MP -MF $(DEPDIR)/test_corrupt-corrupt.Tpo -c -o test_corrupt-corrupt.o `test -f 'corrupt.c' || echo '$(srcdir)/'`corrupt.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_corrupt-corrupt.Tpo $(DEPDIR)/test_corrupt-corrupt.Po
@@ -1802,13 +1830,6 @@ test-syslog.log: test-syslog$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
-../bus/test-bus-system.log: ../bus/test-bus-system$(EXEEXT)
- @p='../bus/test-bus-system$(EXEEXT)'; \
- b='../bus/test-bus-system'; \
- $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
- --log-file $$b.log --trs-file $$b.trs \
- $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
- "$$tst" $(AM_TESTS_FD_REDIRECT)
../dbus/test-dbus.log: ../dbus/test-dbus$(EXEEXT)
@p='../dbus/test-dbus$(EXEEXT)'; \
b='../dbus/test-dbus'; \
@@ -1823,6 +1844,13 @@ test-syslog.log: test-syslog$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+../bus/test-bus-system.log: ../bus/test-bus-system$(EXEEXT)
+ @p='../bus/test-bus-system$(EXEEXT)'; \
+ b='../bus/test-bus-system'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
.test.log:
@p='$<'; \
$(am__set_b); \
diff --git a/test/manual-dir-iter.c b/test/manual-dir-iter.c
new file mode 100644
index 00000000..21ac0e95
--- /dev/null
+++ b/test/manual-dir-iter.c
@@ -0,0 +1,92 @@
+#include <config.h>
+#include "test-utils.h"
+
+#include "dbus/dbus-macros.h"
+#include "dbus/dbus-sysdeps.h"
+
+static void oom (const char *doing) _DBUS_GNUC_NORETURN;
+static void die (const char *message) _DBUS_GNUC_NORETURN;
+
+void
+oom (const char *doing)
+{
+ fprintf (stderr, "*** manual-dir-iter: OOM while %s\n", doing);
+ exit (1);
+}
+
+void
+die (const char *message)
+{
+ fprintf (stderr, "*** manual-dir-iter: %s\n", message);
+ exit (1);
+}
+
+static void
+debug (const char *message)
+{
+ fprintf (stdout, "+++ manual-dir-iter: %s\n", message);
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ DBusString filename;
+ DBusString dirname;
+ DBusError tmp_error;
+ DBusDirIter *dir;
+
+ if (argc != 2)
+ die ("syntax: manual-dir-iter <path>");
+
+ dbus_error_init (&tmp_error);
+
+ if (!_dbus_string_init (&filename))
+ oom ("init filename");
+
+ if (!_dbus_string_init (&dirname))
+ oom ("init dirname");
+
+ _dbus_string_append (&dirname, argv[1]);
+ dir = _dbus_directory_open (&dirname, &tmp_error);
+
+ if (dir == NULL)
+ {
+ fprintf (stderr, "could not open directory: %s: %s\n",
+ tmp_error.name, tmp_error.message);
+ exit(1);
+ }
+
+ while (_dbus_directory_get_next_file (dir, &filename, &tmp_error))
+ {
+ DBusString full_path;
+ if (!_dbus_string_init (&full_path))
+ {
+ oom ("init full_path");
+ }
+
+ if (!_dbus_string_copy (&dirname, 0, &full_path, 0))
+ {
+ oom ("copying full_path to dirname");
+ }
+
+ if (!_dbus_concat_dir_and_file (&full_path, &filename))
+ {
+ oom ("concat full_path");
+ }
+ debug (_dbus_string_get_const_data (&filename));
+ _dbus_string_free (&full_path);
+ }
+
+ if (dbus_error_is_set (&tmp_error))
+ die (tmp_error.message);
+
+ _dbus_string_free (&filename);
+
+ if (dir)
+ _dbus_directory_close (dir);
+
+ _dbus_verbose ("*** Test dir name exiting\n");
+
+ return 0;
+}
diff --git a/tools/dbus-print-message.c b/tools/dbus-print-message.c
index e0dd2da6..6f02ea38 100644
--- a/tools/dbus-print-message.c
+++ b/tools/dbus-print-message.c
@@ -23,6 +23,17 @@
#include <config.h>
#include "dbus-print-message.h"
+#ifdef DBUS_UNIX
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <arpa/inet.h>
+#endif
+
#include <stdlib.h>
#include "config.h"
@@ -143,6 +154,151 @@ print_ay (DBusMessageIter *iter, int depth)
}
static void
+print_fd (int fd, int depth)
+{
+#ifdef DBUS_UNIX
+ int ret;
+ struct stat statbuf = {0,};
+ union {
+ struct sockaddr sa;
+ struct sockaddr_storage storage;
+ struct sockaddr_un un;
+ struct sockaddr_in ipv4;
+ struct sockaddr_in6 ipv6;
+ } addr, peer;
+ char hostip[INET6_ADDRSTRLEN];
+ int addrlen = sizeof (addr);
+ int peerlen = sizeof (peer);
+ int has_peer;
+#endif
+
+ /* Don't print the fd number: it is different in every process and since
+ * dbus-monitor closes the fd after reading it, the same number would be
+ * printed again and again.
+ */
+ printf ("file descriptor\n");
+ if (fd == -1)
+ return;
+
+#ifdef DBUS_UNIX
+ ret = fstat (fd, &statbuf);
+ if (ret == -1)
+ return;
+
+ indent (depth+1);
+ printf ("inode: %d\n", (int) statbuf.st_ino);
+
+ indent (depth+1);
+ printf ("type: ");
+ if (S_ISREG(statbuf.st_mode))
+ printf ("file\n");
+ if (S_ISDIR(statbuf.st_mode))
+ printf ("directory\n");
+ if (S_ISCHR(statbuf.st_mode))
+ printf ("char\n");
+ if (S_ISBLK(statbuf.st_mode))
+ printf ("block\n");
+ if (S_ISFIFO(statbuf.st_mode))
+ printf ("fifo\n");
+ if (S_ISLNK(statbuf.st_mode))
+ printf ("link\n");
+ if (S_ISSOCK(statbuf.st_mode))
+ printf ("socket\n");
+
+ /* If it's not a socket, getsockname will just return -1 with errno
+ * ENOTSOCK. */
+
+ memset (&addr, 0, sizeof (addr));
+ memset (&peer, 0, sizeof (peer));
+
+ if (getsockname(fd, &addr.sa, &addrlen))
+ return;
+
+ has_peer = !getpeername(fd, &peer.sa, &peerlen);
+
+ indent (depth+1);
+ printf ("address family: ");
+ switch (addr.sa.sa_family)
+ {
+ case AF_UNIX:
+ printf("unix\n");
+ if (addr.un.sun_path[0] == '\0')
+ {
+ /* Abstract socket might not be zero-terminated and length is
+ * variable. Who designed this interface?
+ * Write the name in the same way as /proc/net/unix
+ * See manual page unix(7)
+ */
+ indent (depth+1);
+ printf ("name @%.*s\n",
+ (int) (addrlen - sizeof (sa_family_t) - 1),
+ &(addr.un.sun_path[1]));
+
+ if (has_peer)
+ {
+ indent (depth+1);
+ printf ("peer @%.*s\n",
+ (int) (addrlen - sizeof (sa_family_t) - 1),
+ &(addr.un.sun_path[1]));
+ }
+ }
+ else
+ {
+ indent (depth+1);
+ printf ("name %s\n", addr.un.sun_path);
+ if (has_peer)
+ {
+ indent (depth+1);
+ printf ("peer %s\n", peer.un.sun_path);
+ }
+ }
+ break;
+
+ case AF_INET:
+ printf ("inet\n");
+ if (inet_ntop (AF_INET, &addr.ipv4.sin_addr, hostip, sizeof (hostip)))
+ {
+ indent (depth+1);
+ printf ("name %s port %u\n", hostip, ntohs (addr.ipv4.sin_port));
+ }
+ if (has_peer && inet_ntop (AF_INET, &peer.ipv4.sin_addr, hostip, sizeof (hostip)))
+ {
+ indent (depth+1);
+ printf ("peer %s port %u\n", hostip, ntohs (peer.ipv4.sin_port));
+ }
+
+ break;
+
+#ifdef AF_INET6
+ case AF_INET6:
+ printf ("inet6\n");
+ if (inet_ntop (AF_INET6, &addr.ipv6.sin6_addr, hostip, sizeof (hostip)))
+ {
+ indent (depth+1);
+ printf ("name %s port %u\n", hostip, ntohs (addr.ipv6.sin6_port));
+ }
+ if (has_peer && inet_ntop (AF_INET6, &peer.ipv6.sin6_addr, hostip, sizeof (hostip)))
+ {
+ indent (depth+1);
+ printf ("peer %s port %u\n", hostip, ntohs (peer.ipv6.sin6_port));
+ }
+ break;
+#endif
+
+#ifdef AF_BLUETOOTH
+ case AF_BLUETOOTH:
+ printf ("bluetooth\n");
+ break;
+#endif
+
+ default:
+ printf ("unknown (%d)\n", addr.sa.sa_family);
+ break;
+ }
+#endif
+}
+
+static void
print_iter (DBusMessageIter *iter, dbus_bool_t literal, int depth)
{
do
@@ -351,7 +507,15 @@ print_iter (DBusMessageIter *iter, dbus_bool_t literal, int depth)
{
int fd;
dbus_message_iter_get_basic (iter, &fd);
- printf ("unix fd %d\n", fd);
+
+ print_fd (fd, depth+1);
+
+ /* dbus_message_iter_get_basic() duplicated the fd, we need to
+ * close it after use. The original fd will be closed when the
+ * DBusMessage is released.
+ */
+ close (fd);
+
break;
}