Commit graph

4655 commits

Author SHA1 Message Date
Simon McVittie
04bfdb3dbf bus_context_log: remove special handling of !context->syslog
_dbus_log() and _dbus_logv() are always the right functions to call now.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
2016-09-30 19:36:50 +01:00
Simon McVittie
92bd5ef290 _dbus_logv: configurably log to syslog and/or stderr
This changes the behaviour of _dbus_logv() if _dbus_init_system_log() was
not called. Previously, _dbus_logv() would always log to syslog;
additionally, it would log to stderr, unless the process is dbus-daemon
and it was started by systemd. Now, it will log to stderr only,
unless _dbus_init_system_log() was called first.

This is the desired behaviour because when we hook up
_dbus_warn_check_failed() to _dbus_logv() in the next commit, we don't
want typical users of libdbus to start logging their check failures to
syslog - we only want the dbus-daemon to do that.

In practice this is not usually a behaviour change, because there was
only one situation in which we called _dbus_logv() without first calling
_dbus_init_system_log(), namely an error while parsing configuration
files. Initialize the system log "just in time" in that situation
to preserve existing behaviour.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-09-30 19:36:50 +01:00
Simon McVittie
b5c229d3f8 Update autoconf-archive, and use snapshot.debian.org
This way the link won't expire in future.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-09-30 19:35:59 +01:00
Ralf Habacker
1e43857b31 Fix building with CMake for a Unix platform where functions like recv() are in a separate -lsocket, like QNX.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94096
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-18 14:59:41 +02:00
Ralf Habacker
5bb70dd554 Fix building with CMake for a Unix platform that does not have -lrt, such as Android.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94096
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-18 14:59:22 +02:00
Simon McVittie
1a36f9832a Document default limits in system.conf.in
I left them commented out to minimize the impact if we change them in
one place and not the other, but we should try to keep them in sync
anyway.
2016-08-16 18:27:47 +01:00
Simon McVittie
fa8637256f Log max_pending_service_starts (aka max_pending_activations) when exceeded
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
2016-08-16 18:27:47 +01:00
Simon McVittie
920af242e8 Log service_start_timeout (aka activation_timeout) when we exceed it
Also upgrade it to a warning.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
2016-08-16 18:27:47 +01:00
Simon McVittie
a363822f5f dbus-daemon test: exercise pending fd timeout test
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 18:27:43 +01:00
Simon McVittie
05cb619f0a Log to syslog when pending_fd_timeout is exceeded
This is either a denial-of-service attempt, a pathological performance
problem or a dbus-daemon bug. Sysadmins should be told about any of
these.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
[smcv: add units to timeout: it is in milliseconds]
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-16 17:44:30 +01:00
Simon McVittie
3bc74092ca dbus-daemon test: exercise max_names_per_connection limit
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 17:44:30 +01:00
Simon McVittie
935555c2ce Log when we exceed max_names_per_connection (aka max_services_per_connection)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
2016-08-16 17:44:30 +01:00
Simon McVittie
951fd317ca dbus-daemon test: exercise maximum match rules per connection
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 17:44:30 +01:00
Simon McVittie
b32f7360b7 Log when we exceed max_match_rules_per_connection 2016-08-16 17:44:30 +01:00
Simon McVittie
5cfd755f5d dbus-daemon test: exercise maximum replies per connection
This time we're doing so deliberately.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 17:44:30 +01:00
Simon McVittie
78b40bbde8 dbus-daemon test: avoid reaching pending reply limit
We were not actually doing what was intended (flooding the bus with
10k or 100k messages for the other side) because the bus was limiting
the sender to 128 parallel method calls.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 17:44:30 +01:00
Simon McVittie
de83bdc404 Log when we exceed max_replies_per_connection 2016-08-16 17:44:30 +01:00
Simon McVittie
de0cf5a070 dbus-daemon test: exercise maximum connection counts
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-16 17:44:30 +01:00
Simon McVittie
338d28a847 Log to syslog if max_completed_connections or max_connections_per_user are exceeded
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
2016-08-16 16:16:32 +01:00
Simon McVittie
8415c2ab57 Only compile test-bus-launch-helper, etc. if embedded tests are enabled
These source files are specific to the embedded tests and make no sense
otherwise.

Also remove a comment in the CMake build system about fixing the
build of the activation helper on Windows: the activation helper
is Unix-specific and always will be, since it relies on Unix setuid
to function.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94094
2016-08-16 14:26:40 +01:00
Simon McVittie
7b66534945 Merge remote-tracking branch 'github/master' 2016-08-16 00:25:01 +01:00
Simon McVittie
b08487d482 1.11.5 2016-08-16 00:21:48 +01:00
Simon McVittie
b2ec081f4f Merge remote-tracking branch 'origin/master' 2016-08-16 00:21:19 +01:00
Simon McVittie
b25d78a16d 1.11.4 2016-08-15 21:44:06 +01:00
Simon McVittie
b0e3fb6e48 Merge branch 'dbus-1.10' 2016-08-15 21:38:52 +01:00
Simon McVittie
823801b467 Travis-CI: fetch a newer autoconf-archive from Debian
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-15 20:41:28 +01:00
Simon McVittie
095ca78ae7 Travis-CI: install new autoconf-archive build-dependency
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-15 20:12:19 +01:00
Simon McVittie
0bbfca6def autogen.sh: fail cleanly if autoconf fails
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-15 20:11:49 +01:00
Simon McVittie
640c5ad853 1.10.10
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-15 19:59:18 +01:00
Simon McVittie
73b03e0bfb name-test, tools: add missing COVERAGE_CFLAGS
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-15 15:17:31 +01:00
Simon McVittie
2ec7c67b16 Document use of AX_CODE_COVERAGE
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-08-15 14:31:44 +01:00
Thomas Zimmermann
be04ba8354 Use AX_CODE_COVERAGE for test-coverage statistics
DBus uses custom rules in its Makefiles to implement test-coverage
statistics.

This patch implements test-coverage statistics with the autoconf macro
AX_CODE_COVERAGE. The script automatically tests for tools (e.g., gcov,
lcov), sets build variables and creates Makefile rules.

Run 'configure' with '--enable-code-coverage' to enable support for
test-coverage statistics. Run 'make check-code-coverage' to run the
tests and generate the statistics.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
[smcv: do not alter compiler.m4; move AM_CXXFLAGS to the one place we
compile C++]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88922
2016-08-15 14:30:51 +01:00
Simon McVittie
1a30d452a4 Merge branch 'dbus-1.10' 2016-08-12 18:24:10 +01:00
Simon McVittie
c56cc26164 Add a regression test for dbus-launch in X11
[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:21:36 +01:00
Simon McVittie
6ce19c8625 test-dbus-daemon-fork: exercise closed stdin, stdout, stderr
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:21:36 +01:00
Simon McVittie
1679f58a14 test: expand dbus-launch-eval test to cover stdin being closed
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:21:36 +01:00
Simon McVittie
a7caca9f47 Add a simple test for dbus-daemon --fork
[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:21:32 +01:00
Simon McVittie
042391e88a test: add a regression test for eval "$(dbus-launch --sh-syntax)"
[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:21:01 +01:00
Simon McVittie
67f2fed1fd test-dbus-launch-x11: extend to cover --exit-with-x11
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 18:13:47 +01:00
Simon McVittie
01ffa21501 Add a regression test for dbus-launch in X11
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
2016-08-12 18:13:21 +01:00
Simon McVittie
53fe3b44af test-dbus-daemon-fork: exercise closed stdin, stdout, stderr
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
2016-08-12 18:13:13 +01:00
Simon McVittie
4710c60bbf Add a simple test for dbus-daemon --fork
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Colin Walters
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
2016-08-12 18:12:46 +01:00
Simon McVittie
0e0a032aa2 test: add a regression test for eval "$(dbus-launch --sh-syntax)"
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
2016-08-12 18:12:41 +01:00
Simon McVittie
b7d280f623 _dbus_change_to_daemon_user (audit code path): set DBusError correctly
The other error cases here all set the error instead of just warning.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
2016-08-12 17:34:29 +01:00
Simon McVittie
76ae52735e Remove trailing newlines from _dbus_assert_not_reached
This was never necessary: _dbus_assert_not_reached() always added one.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
2016-08-12 17:11:48 +01:00
Simon McVittie
f518165b84 dbus-daemon, dbus-launch: cope with callers having closed standard fds
In Debian bug <https://bugs.debian.org/829348>, lightdm appears to
have been starting dbus-launch with at least one of the three
standard fds 0, 1, 2 (stdin, stdout, stderr) closed. This resulted
in the dbus-daemon's epoll_create1() returning a fd less than 3.
Later, _dbus_become_daemon() replaces fds 0-2 with /dev/null. As a
result, a subsequent call to _dbus_loop_add_watch() for the reload
pipe resulted in calling epoll_ctl on the non-epoll fd pointing to
/dev/null, which fails with EINVAL, resulting in the dbus-daemon
exiting unsuccessfully.

Unix programs are not normally expected to behave correctly when
launched with the standard fds not already open; but at the same time,
X11 autolaunching means that dbus-launch (and hence the dbus-daemon)
can get started from an arbitrarily precarious situation.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
(cherry picked from commit c8f73a2a3a)
2016-08-12 10:58:38 +01:00
Simon McVittie
ed33129fe4 _dbus_ensure_standard_fds: new function to ensure std* fds are open
This function opens stdin, stdout, stderr pointing to /dev/null
if they aren't already open. Optionally, it can also replace
whatever is available on those fds with /dev/null.

To allow for use in contexts where only async-signal-safe functions
should be used, such as between fork() and a following exec(),
this function does not use conventional libdbus error handling
(which would require malloc). Instead, it sets errno and returns
an explanatory string.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
(cherry picked from commit 69123a6bd2)
2016-08-12 10:58:38 +01:00
Simon McVittie
6d8a198de9 various tests: produce better diagnostics on error
Same root cause as <https://bugs.freedesktop.org/show_bug.cgi?id=96653>:
we didn't check whether the message was in fact an error reply.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-08-12 10:25:06 +01:00
Simon McVittie
e9d37affcd More NEWS for 1.11 2016-08-12 10:17:46 +01:00
Simon McVittie
53ddb81c8c Merge branch 'dbus-1.10' 2016-08-12 10:14:46 +01:00