platform/upstream/dbus.git
8 years agoMerge remote-tracking branch 'origin/master'
Simon McVittie [Fri, 6 Nov 2015 17:36:00 +0000 (18:36 +0100)]
Merge remote-tracking branch 'origin/master'

8 years agoUpdate NEWS (and pending spec version)
Simon McVittie [Fri, 6 Nov 2015 17:34:46 +0000 (18:34 +0100)]
Update NEWS (and pending spec version)

8 years agoDisallow unexpected replies
Lars Uebernickel [Mon, 2 Nov 2015 14:47:39 +0000 (15:47 +0100)]
Disallow unexpected replies

Allowing to send replies when NO_REPLY_EXPECTED is set is useless in
practice: Clients need to be careful not to send these replies, because
bus policy could deny these messages. The spec even mentions that this
issue exists.

To make this more clear and misbehaving clients less likely, disallow
sending unexpected replies entirely.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=75749
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Fri, 6 Nov 2015 17:27:45 +0000 (18:27 +0100)]
Merge branch 'dbus-1.10'

8 years agoupdate NEWS
Simon McVittie [Fri, 6 Nov 2015 17:26:40 +0000 (18:26 +0100)]
update NEWS

8 years agoMerge branch 'dbus-1.10'
Ralf Habacker [Fri, 6 Nov 2015 16:56:56 +0000 (17:56 +0100)]
Merge branch 'dbus-1.10'

8 years agoFix test cases running client and server dispatch design issue.
Ralf Habacker [Fri, 6 Nov 2015 13:03:23 +0000 (14:03 +0100)]
Fix test cases running client and server dispatch design issue.

DBus test cases running the server *and* client loop in the same
process assumed that all messages send from the server has to be
received in one client dispatch, which is not the case in all
environments.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoFix bug unrefing connection too early in check_hello_message().
Ralf Habacker [Fri, 6 Nov 2015 13:02:29 +0000 (14:02 +0100)]
Fix bug unrefing connection too early in check_hello_message().

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Fri, 6 Nov 2015 11:12:55 +0000 (12:12 +0100)]
Merge branch 'dbus-1.10'

8 years agoCompile fix on Windows.
Ralf Habacker [Wed, 4 Nov 2015 13:21:20 +0000 (14:21 +0100)]
Compile fix on Windows.

This commit fixes a regression introduced with commit 04b8a7a772cfa9ae8ea6ce452d1fb7f23e25fd3f.

8 years agoFix warning: variable 'ret' set but not used [-Wunused-but-set-variable].
Ralf Habacker [Mon, 2 Nov 2015 20:56:32 +0000 (21:56 +0100)]
Fix warning: variable 'ret' set but not used [-Wunused-but-set-variable].

Only set valid child status in case exit code has been gotten from
child process, otherwise signal failure through thread return value.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoTest system bus config files on Unix only
Ralf Habacker [Mon, 2 Nov 2015 23:23:56 +0000 (00:23 +0100)]
Test system bus config files on Unix only

Previously, we didn't consistently test parsing of every file in
valid-config-files-system/ everywhere that we tested valid-config-files/.
We now test it on Unix.

The system bus is not supported on Windows, so we do not test
valid-config-files-system/ there.

valid-config-files/many-rules.conf contains <user> and <group> rules
which are not applicable to Windows. Copy the original many-rules.conf
to valid-config-files-system/ so that it will be tested on Unix, and
remove the non-portable rules from valid-config-files/many-rules.conf.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
[rh:base patch came from Simon]

8 years agoDon't use _dbus_warn() for intentionally-skipped tests
Simon McVittie [Mon, 2 Nov 2015 18:19:02 +0000 (18:19 +0000)]
Don't use _dbus_warn() for intentionally-skipped tests

The tests are run with _dbus_warn() fatal, so if a particular test is
not applicable on the current platform, we shouldn't call it.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agotest_default_session_servicedirs: use the intended data directory
Simon McVittie [Mon, 2 Nov 2015 14:24:51 +0000 (14:24 +0000)]
test_default_session_servicedirs: use the intended data directory

If D-Bus was configured for /usr/local and built in Z:/build,
the previous code would use

    Z:/build/dbus/.libs/usr/local/share/dbus-1/services

whereas the intention was to replace the configured prefix /usr/local
with the detected location, more like

    Z:/build/dbus/.libs/share/dbus-1/services

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agotest_default_session_servicedirs: simplify to a single exit code-path
Simon McVittie [Mon, 2 Nov 2015 14:15:14 +0000 (14:15 +0000)]
test_default_session_servicedirs: simplify to a single exit code-path

A similar simplification was already done on master as part of commit
f830e14, Bug #83539.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoFix warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement].
Ralf Habacker [Sat, 31 Oct 2015 20:06:04 +0000 (21:06 +0100)]
Fix warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement].

Includes minor indention fix.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoFix typo and missing eol on debug message.
Ralf Habacker [Sat, 31 Oct 2015 20:05:03 +0000 (21:05 +0100)]
Fix typo and missing eol on debug message.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoWrap path verbose output with '' to be able to see trailing spaces.
Ralf Habacker [Fri, 30 Oct 2015 05:14:44 +0000 (06:14 +0100)]
Wrap path verbose output with '' to be able to see trailing spaces.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agorefs test: reduce number of repeats under Wine
Simon McVittie [Thu, 29 Oct 2015 05:31:38 +0000 (06:31 +0100)]
refs test: reduce number of repeats under Wine

Under Wine, the API calls we use to do this are implemented via IPC
to wineserver, which makes it unreasonably slow to try to brute-force
bugs by having many threads stress-test refcounting. Do a few
repetitions just to verify that refcounting basically works, but
don't do the full stress-test.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92538
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[rh: add WINESERVERSOCKET related hint]

8 years agoWhen running TAP tests, filter out trailing \r from Windows .exe
Simon McVittie [Mon, 19 Oct 2015 15:02:36 +0000 (16:02 +0100)]
When running TAP tests, filter out trailing \r from Windows .exe

If we're running Windows executables using Wine, then tap-driver.sh
won't accept "1..4\r\n" as TAP syntax.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92538
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoFix crash running test-syslog on windows/wine.
Ralf Habacker [Tue, 3 Feb 2015 18:56:32 +0000 (19:56 +0100)]
Fix crash running test-syslog on windows/wine.

Use seperate buffer in _dbus_system_logv() to avoid crash in vsprintf().

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92538
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoDisplay autolaunch scope on verbose print of daemon found message on windows.
Ralf Habacker [Sun, 4 Oct 2015 08:33:32 +0000 (10:33 +0200)]
Display autolaunch scope on verbose print of daemon found message on windows.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92080
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoMerge remote-tracking branch 'origin/dbus-1.10'
Simon McVittie [Mon, 26 Oct 2015 19:03:25 +0000 (19:03 +0000)]
Merge remote-tracking branch 'origin/dbus-1.10'

8 years ago1.10.3
Simon McVittie [Mon, 26 Oct 2015 18:54:04 +0000 (18:54 +0000)]
1.10.3

8 years ago1.10.2
Simon McVittie [Mon, 26 Oct 2015 12:54:26 +0000 (12:54 +0000)]
1.10.2

8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Mon, 26 Oct 2015 12:49:18 +0000 (12:49 +0000)]
Merge branch 'dbus-1.10'

8 years agoAdd a regression test for invalid BecomeMonitor calls
Simon McVittie [Mon, 19 Oct 2015 13:50:37 +0000 (14:50 +0100)]
Add a regression test for invalid BecomeMonitor calls

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92298

8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Mon, 26 Oct 2015 12:11:35 +0000 (12:11 +0000)]
Merge branch 'dbus-1.10'

8 years agoNEWS
Simon McVittie [Mon, 26 Oct 2015 12:05:09 +0000 (12:05 +0000)]
NEWS

8 years agouser dbus.socket: Set DBUS_SESSION_BUS_ADDRESS
Jan Alexander Steffens (heftig) [Thu, 22 Oct 2015 17:50:29 +0000 (19:50 +0200)]
user dbus.socket: Set DBUS_SESSION_BUS_ADDRESS

As discussed in <https://github.com/systemd/systemd/issues/1600>.
See also <https://bugs.archlinux.org/task/46721>,
<https://bugzilla.gnome.org/show_bug.cgi?id=756420>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92612
[smcv: use AC_PATH_PROG to find systemctl; ignore systemctl failure]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
[smcv: add links to earlier bug reports elsewhere]

8 years agoWhen running dbus-daemon --session in tests, override listen address
Simon McVittie [Mon, 19 Oct 2015 14:19:27 +0000 (15:19 +0100)]
When running dbus-daemon --session in tests, override listen address

Otherwise, we can't reliably run tests for Windows, because the default
listening address on Windows is "autolaunch:" which is global to
a machine, resulting in testing an installed dbus-daemon instead of
the one we intended to test.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92538
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoDisable activation tests on Windows builds
Simon McVittie [Mon, 19 Oct 2015 14:18:02 +0000 (15:18 +0100)]
Disable activation tests on Windows builds

These rely on the --systemd-activation code path, which is not
compiled for Windows.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92538
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoKeep cmake build system in sync with autotools (add test-monitor).
Ralf Habacker [Wed, 21 Oct 2015 11:19:48 +0000 (13:19 +0200)]
Keep cmake build system in sync with autotools (add test-monitor).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92298
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Mon, 19 Oct 2015 15:52:08 +0000 (16:52 +0100)]
Merge branch 'dbus-1.10'

8 years agoNEWS
Simon McVittie [Mon, 19 Oct 2015 15:37:34 +0000 (16:37 +0100)]
NEWS

8 years agoBecomeMonitor: do not overwrite error with another error
Simon McVittie [Tue, 6 Oct 2015 11:43:22 +0000 (12:43 +0100)]
BecomeMonitor: do not overwrite error with another error

If the user gave us a syntactically invalid error name, we'd
overwrite the MatchRuleInvalid error with NoMemory, causing an
assertion failure (crash) in the dbus-daemon.

This is not a denial-of-service vulnerability on the system bus,
because monitoring is a privileged action, and root privilege
is checked before this code is reached. However, it's an annoying
bug on the session bus.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92298
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoNEWS
Simon McVittie [Tue, 6 Oct 2015 12:15:40 +0000 (13:15 +0100)]
NEWS

8 years agoAssume that DBUS_DATADIR is absolute on Windows
Simon McVittie [Fri, 2 Oct 2015 15:51:59 +0000 (16:51 +0100)]
Assume that DBUS_DATADIR is absolute on Windows

Both build systems arrange for this to be the case,
and we already assume that it's absolute on Unix.
On Windows, it's probably going to be /mingw/share or
something; it gets relocated via _dbus_replace_install_prefix()
at runtime.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83539
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agocmake: simplify definition of installation paths
Simon McVittie [Fri, 2 Oct 2015 15:24:21 +0000 (16:24 +0100)]
cmake: simplify definition of installation paths

In particular, changing the meaning of DBUS_DATADIR part
way through the file is really confusing.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83539
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoReplace build-time prefix with installation prefix when including config files
Simon McVittie [Thu, 1 Oct 2015 12:05:02 +0000 (13:05 +0100)]
Replace build-time prefix with installation prefix when including config files

This was already done for the contents of .service files, but not
config files.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92028
Tested-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoUse DBusString for all relocation and install-root code
Simon McVittie [Wed, 30 Sep 2015 15:35:49 +0000 (16:35 +0100)]
Use DBusString for all relocation and install-root code

This means we handle OOM correctly, and makes it obvious
that we are not overflowing buffers. This change does not
affect the actual content of the strings.

Instead of redefining DBUS_DATADIR to be a function call
(which hides the fact that DBUS_DATADIR is used),
this patch makes each use explicit: DBUS_DATADIR
is always the #define from configure or cmake, before
replacing the prefix.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83539
Tested-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Fri, 2 Oct 2015 10:52:35 +0000 (11:52 +0100)]
Merge branch 'dbus-1.10'

8 years agoNEWS
Simon McVittie [Fri, 2 Oct 2015 10:51:40 +0000 (11:51 +0100)]
NEWS

8 years agoOn Windows, load local configuration relative to bus setup
Simon McVittie [Thu, 1 Oct 2015 18:17:49 +0000 (19:17 +0100)]
On Windows, load local configuration relative to bus setup

This makes an installed tree with

    /some-prefix/
        etc/
            dbus-1/
                session-local.conf
        share/
            dbus-1/
                session.conf

relocatable to any location.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92028
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Tested-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoCancel pending activation on any activation error
Simon McVittie [Wed, 30 Sep 2015 16:15:53 +0000 (17:15 +0100)]
Cancel pending activation on any activation error

This fixes the error reporting if you make two attempts
to activate a service that cannot be activated due to an
error that is reported synchronously, such as a system
service with no User= line in its .service file.

This is easy to reproduce with the gdbus(1) tool, which
sends an Introspect call in addition to the one you asked
it to. If you try to activate a service using

gdbus call --session -d com.example.FailToActivate \
    -o / -m org.freedesktop.DBus.Peer.Ping

then gdbus will actually send two method calls: one
Introspect, and one Ping. The Introspect gets the correct
error reply, but when dbus-daemon enters
bus_activation_activate_service() for the Ping call, it
sees that there is a pending activation and does an
early-return. The pending activation does not finish
until the timeout is reached.

A couple of error cases handled this correctly, but the
majority did not; make them all go into the same code path.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92200
Reviewed-by: Thiago Macieira <thiago@kde.org>
8 years agoNEWS
Simon McVittie [Wed, 30 Sep 2015 17:37:36 +0000 (18:37 +0100)]
NEWS

8 years agoUse C99 standard PRI*64 for printing 64 bit integers
Natanael Copa [Fri, 18 Sep 2015 13:27:50 +0000 (15:27 +0200)]
Use C99 standard PRI*64 for printing 64 bit integers

Use the standard C99 PRI*64 macros instead of checking for specific GNU
libc version. We also specifically check for windows which does not have
proper C99 support.

This fixes printing of int64 on non-GNU 32 bit systems (like musl libc).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92043
Reviewed-by: Thiago Macieira <thiago@kde.org>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
[smcv: fix extra % in the Windows fallbacks; include <inttypes.h> where needed]

8 years agoRename getters for session, system config files
Simon McVittie [Fri, 18 Sep 2015 16:52:07 +0000 (17:52 +0100)]
Rename getters for session, system config files

It turns out to be easier to implement the Windows version
of these in a relocatable way if it can assume that the
argument starts empty, which is in fact true in practice.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83539
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Wed, 30 Sep 2015 14:49:20 +0000 (15:49 +0100)]
Merge branch 'dbus-1.10'

8 years agoNEWS
Simon McVittie [Wed, 30 Sep 2015 14:49:06 +0000 (15:49 +0100)]
NEWS

8 years agoFix creation of Exec path for files not in prefix
Milan Crha [Fri, 18 Sep 2015 15:22:29 +0000 (16:22 +0100)]
Fix creation of Exec path for files not in prefix

Doing strcat() into a static buffer produces incorrect results for
the second and subsequent services if they are not in the ${prefix};
for example, if the first call should have returned
"C:\bar\bin\service1" and the second should have returned
"C:\bar\bin\service2", the second result would actually be
"C:\bar\bin\service1C:\bar\bin\service2".

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83539
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
[smcv: added commit message; used strncpy/strncat to avoid overflow]
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agoMake Windows dbus-daemon look for the config file we install
Ralf Habacker [Sun, 20 Sep 2015 11:47:23 +0000 (13:47 +0200)]
Make Windows dbus-daemon look for the config file we install

The canonical location for bus setup changed from
${sysconfdir}/dbus-1 to ${datadir}/dbus-1 (or their CMake
equivalents) in version 1.9.18.

Also stop trying to use bus/session.conf from the build tree,
which will not work if our ${prefix} contains an older
${sysconfdir}/dbus-1/session.conf.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92028
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
8 years agomention o.fd.DBus.Verbose in the NEWS too
Simon McVittie [Tue, 25 Aug 2015 18:54:18 +0000 (19:54 +0100)]
mention o.fd.DBus.Verbose in the NEWS too

8 years agomention o.fd.DBus.Verbose in the NEWS too
Simon McVittie [Tue, 25 Aug 2015 18:54:18 +0000 (19:54 +0100)]
mention o.fd.DBus.Verbose in the NEWS too

8 years agoStart towards 1.11.0
Simon McVittie [Tue, 25 Aug 2015 18:35:35 +0000 (19:35 +0100)]
Start towards 1.11.0

8 years agostart towards 1.10.2
Simon McVittie [Tue, 25 Aug 2015 18:34:54 +0000 (19:34 +0100)]
start towards 1.10.2

8 years ago1.10.0
Simon McVittie [Tue, 25 Aug 2015 15:51:59 +0000 (16:51 +0100)]
1.10.0

8 years agoaudit: make the first few fds close-on-exec
Simon McVittie [Wed, 19 Aug 2015 22:47:40 +0000 (23:47 +0100)]
audit: make the first few fds close-on-exec

libcap-ng < 0.7.7 leaks one non-close-on-exec fd during initialization.
test-bus asserts that all fds beyond 2 passed to an executed subprocess
have the close-on-exec flag set, which will fail at that leaked fd.

This was unnoticed until commit 517c4685, because libaudit was
previously only initialized if we were configured to switch uid,
which the regression tests do not do; the system bus is normally
the only place that happens, but the system bus is not normally
run with the "embedded tests" enabled (since they are bad
for performance and security).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=91684
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
8 years agoDistribute tap-test.sh.in unconditionally
Simon McVittie [Wed, 19 Aug 2015 21:04:30 +0000 (22:04 +0100)]
Distribute tap-test.sh.in unconditionally

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=91684
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
8 years ago1.9.21
Simon McVittie [Thu, 6 Aug 2015 23:15:34 +0000 (00:15 +0100)]
1.9.21

8 years agoPrepare 1.9.20 (1.10rc1)
Simon McVittie [Thu, 6 Aug 2015 17:55:31 +0000 (18:55 +0100)]
Prepare 1.9.20 (1.10rc1)

8 years agoNEWS
Simon McVittie [Thu, 6 Aug 2015 16:44:21 +0000 (17:44 +0100)]
NEWS

8 years agoThrow a warning if we cannot open the audit socket as a session bus
Laurent Bigonville [Mon, 15 Jun 2015 13:31:58 +0000 (15:31 +0200)]
Throw a warning if we cannot open the audit socket as a session bus

This will effectively print a warning when failing to open the audit
socket running as a session bus.

The call to audit_open() should succeed even if the dbus-daemon doesn't
have the CAP_AUDIT_WRITE capability.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83856
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoInitialize audit subsystem even for the session bus
Laurent Bigonville [Mon, 15 Jun 2015 13:30:16 +0000 (15:30 +0200)]
Initialize audit subsystem even for the session bus

If SELinux is enabled on the system, dbus will check the permissions but
no audit trails will be generated in case of denial as the audit
subsystem is not initialized. Same should apply for apparmor.

[smcv: without audit, the equivalent of the audit trail goes to stderr
where it can be picked up by systemd-journald]

A unprivileged user should be able to open the audit socket
(audit_open()) but should not have the permissions to log an audit
trail. The CAP_AUDIT_WRITE file capability could be set on the
dbus-daemon executable in order to allow the session bus to log an AVC
denial.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83856
[smcv: s/should/could/ in commit message to reflect lack of consensus that
"setcap cap_audit_write+ep dbus-daemon" is desirable in general]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoaudit: only check for CAP_AUDIT_WRITE once, during initialization
Simon McVittie [Fri, 3 Jul 2015 15:57:28 +0000 (16:57 +0100)]
audit: only check for CAP_AUDIT_WRITE once, during initialization

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89225
Reviewed-by: Colin Walters <walters@verbum.org>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoaudit: use DBUS_SYSTEM_LOG_WARNING if we cannot open the audit fd
Simon McVittie [Thu, 19 Feb 2015 12:08:59 +0000 (12:08 +0000)]
audit: use DBUS_SYSTEM_LOG_WARNING if we cannot open the audit fd

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89225
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agobus: move shared libaudit code to a new audit.[ch]
Simon McVittie [Thu, 19 Feb 2015 12:04:26 +0000 (12:04 +0000)]
bus: move shared libaudit code to a new audit.[ch]

This fixes various duplicated libaudit interactions in both
SELinux and AppArmor code paths, including opening two audit sockets
if both SELinux and AppArmor were enabled at compile time.
In particular, audit.c is now the only user of libcap-ng.

This commit is not intended to introduce any functional changes,
except for the de-duplication.

The actual audit_log_user_avc_message() call is still duplicated,
because the SELinux and AppArmor code paths use different mechanisms
to compose the audit message: the SELinux path uses a statically-sized
buffer on the stack which might be subject to truncation, whereas
the AppArmor path uses malloc() (via DBusString) and falls back to
using syslog on a memory allocation failure.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89225
Reviewed-by: Colin Walters <walters@verbum.org>
[smcv: minor issues raised during review are subsequently fixed]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoUse poll's data types directly, where used at all
Rolland Dudemaine [Thu, 6 Aug 2015 13:01:06 +0000 (14:01 +0100)]
Use poll's data types directly, where used at all

[smcv: added commit message; moved fallback implementation
below definition of DBusPollable; more comments; removed unnecessary cast]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90314
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years ago1.9.19
Simon McVittie [Tue, 21 Jul 2015 20:13:43 +0000 (21:13 +0100)]
1.9.19

9 years agodbus-1.9.16
Simon McVittie [Tue, 21 Jul 2015 16:52:21 +0000 (17:52 +0100)]
dbus-1.9.16

9 years agodbus-1.8.20
Simon McVittie [Tue, 21 Jul 2015 16:32:17 +0000 (17:32 +0100)]
dbus-1.8.20

9 years agoMerge branch 'dbus-1.8'
Simon McVittie [Tue, 21 Jul 2015 16:20:11 +0000 (17:20 +0100)]
Merge branch 'dbus-1.8'

Conflicts:
.gitignore
NEWS
tools/dbus-monitor.c

9 years agoNEWS for 1.8.x
Simon McVittie [Tue, 21 Jul 2015 16:19:25 +0000 (17:19 +0100)]
NEWS for 1.8.x

9 years agodbus-monitor: disable automatic handling of o.fd.Peer messages
Simon McVittie [Fri, 3 Jul 2015 12:50:04 +0000 (13:50 +0100)]
dbus-monitor: disable automatic handling of o.fd.Peer messages

A normal DBusConnection will automatically reply to o.fd.Peer
messages such as Ping. We don't want this: we'll
confuse everyone else by replying to messages that weren't
intended for us.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90952
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
(cherry picked from commit d9ee040d0bff2b421bca80c2339dcd9347d906db,
commit message adjusted to describe the impact in versions < 1.9)
Conflicts:
tools/dbus-monitor.c

9 years ago.gitignore: ignore /test-driver, generated by recent Automake
Simon McVittie [Mon, 3 Mar 2014 15:59:10 +0000 (15:59 +0000)]
.gitignore: ignore /test-driver, generated by recent Automake

(cherry picked from commit 1895a8ee5b0e3813b571e9db3528611802ea7f7e)

9 years agoAdd test-case for the same situation as fd.o #90952
Simon McVittie [Fri, 3 Jul 2015 12:59:44 +0000 (13:59 +0100)]
Add test-case for the same situation as fd.o #90952

This does not directly test the code in the previous commit, but it does
confirm that calling dbus_connection_set_route_peer_messages() is enough
to fix the observed bug.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90952
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
[smcv: re-worded commit message in response to review]

9 years agodbus-monitor: disable automatic handling of o.fd.Peer messages
Simon McVittie [Fri, 3 Jul 2015 12:50:04 +0000 (13:50 +0100)]
dbus-monitor: disable automatic handling of o.fd.Peer messages

A normal DBusConnection will automatically reply to o.fd.Peer
messages such as Ping. We don't want this: if we are using
traditional eavesdropping with an older dbus-daemon, we'll
confuse everyone else by replying to messages that weren't
intended for us. If we are using the new Monitoring
interface (since 1.9.12), the same still applies, but in
addition, the dbus-daemon will disconnect us for not being
a well-behaved monitor.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90952
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
9 years agobus_registry_new: Assert in case of not valid context parameter to avoid potiental...
Ralf Habacker [Tue, 21 Apr 2015 11:16:53 +0000 (13:16 +0200)]
bus_registry_new: Assert in case of not valid context parameter to avoid potiental crashes (CID 54764).

Because the context parameter is dereferenced several times in related code without a null check,
we need to make sure to have a valid context.

Reported by Coverity: CID 54764: Dereference after null check (FORWARD_NULL)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoMerge branch 'dbus-1.8'
Simon McVittie [Wed, 17 Jun 2015 19:41:24 +0000 (20:41 +0100)]
Merge branch 'dbus-1.8'

Conflicts:
NEWS

9 years agoNEWS
Simon McVittie [Wed, 17 Jun 2015 19:40:51 +0000 (20:40 +0100)]
NEWS

9 years agoFix memleak in GetConnectionCredentials handler
Jacek Bukarewicz [Wed, 17 Jun 2015 17:53:41 +0000 (18:53 +0100)]
Fix memleak in GetConnectionCredentials handler

Reply message was not unreferenced when GetConnectionCredentials
handler was successful.

Signed-off-by: Jacek Bukarewicz <j.bukarewicz@samsung.com>
[smcv: changed bus_message_unref() to dbus_message_unref()]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=91008

9 years agotests: use the new bus setup for `make installcheck`
Simon McVittie [Wed, 27 May 2015 10:42:44 +0000 (11:42 +0100)]
tests: use the new bus setup for `make installcheck`

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280
Reviewed-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
9 years agodbus-daemon.1: document the new locations
Simon McVittie [Wed, 27 May 2015 10:42:18 +0000 (11:42 +0100)]
dbus-daemon.1: document the new locations

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280
Reviewed-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
9 years agoNEWS
Simon McVittie [Wed, 27 May 2015 10:02:05 +0000 (11:02 +0100)]
NEWS

9 years agoAdjust cmake build to match autoconf installation locations.
Dimitri John Ledkov [Mon, 2 Mar 2015 11:55:54 +0000 (11:55 +0000)]
Adjust cmake build to match autoconf installation locations.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoMove session & system bus configuration to datadir, by default.
Dimitri John Ledkov [Wed, 25 Feb 2015 15:39:04 +0000 (15:39 +0000)]
Move session & system bus configuration to datadir, by default.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoStart towards 1.9.18
Simon McVittie [Wed, 27 May 2015 09:42:46 +0000 (10:42 +0100)]
Start towards 1.9.18

9 years agomore NEWS, also more release name
Simon McVittie [Thu, 14 May 2015 14:04:36 +0000 (15:04 +0100)]
more NEWS, also more release name

9 years ago1.9.16
Simon McVittie [Thu, 14 May 2015 13:50:24 +0000 (14:50 +0100)]
1.9.16

9 years agoMerge branch 'dbus-1.8'
Simon McVittie [Thu, 14 May 2015 13:45:04 +0000 (14:45 +0100)]
Merge branch 'dbus-1.8'

Conflicts:
NEWS

9 years agoadd a missing change, fix some bug numbers
Simon McVittie [Thu, 14 May 2015 13:43:53 +0000 (14:43 +0100)]
add a missing change, fix some bug numbers

9 years agoMerge branch 'dbus-1.8'
Simon McVittie [Thu, 14 May 2015 13:41:06 +0000 (14:41 +0100)]
Merge branch 'dbus-1.8'

Conflicts:
NEWS
cmake/CMakeLists.txt
configure.ac

9 years agoFail to generate random bytes instead of falling back to rand()
Simon McVittie [Thu, 14 May 2015 11:23:09 +0000 (12:23 +0100)]
Fail to generate random bytes instead of falling back to rand()

This is more robust against broken setups where we run out
of memory or cannot read /dev/urandom.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: document @error]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoMake UUID generation failable
Simon McVittie [Tue, 12 May 2015 10:35:04 +0000 (11:35 +0100)]
Make UUID generation failable

Previously, this would always succeed, but might use
weak random numbers in rare failure cases. I don't think
these UUIDs are security-sensitive, but if they're generated
by a PRNG as weak as rand() (<= 32 bits of entropy), we
certainly can't claim that they're universally unique.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: document @error]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years ago_dbus_server_init_base: raise a DBusError
Simon McVittie [Thu, 14 May 2015 11:17:54 +0000 (12:17 +0100)]
_dbus_server_init_base: raise a DBusError

This can currently only fail from OOM, but I'm about to make
it possible to fail from insufficient entropy.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: document @error]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years ago_dbus_server_new_for_socket: raise a DBusError
Simon McVittie [Thu, 14 May 2015 11:17:10 +0000 (12:17 +0100)]
_dbus_server_new_for_socket: raise a DBusError

This can currently only fail due to OOM, but I'm about to
make it possible to fail for other reasons.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: correct failure to set error in one case; document @error]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoSecurity hardening: force EXTERNAL auth in session.conf on Unix
Simon McVittie [Tue, 12 May 2015 10:10:58 +0000 (11:10 +0100)]
Security hardening: force EXTERNAL auth in session.conf on Unix

DBUS_COOKIE_SHA1 is dependent on unguessable strings, i.e.
indirectly dependent on high-quality pseudo-random numbers
whereas EXTERNAL authentication (credentials-passing)
is mediated by the kernel and cannot be faked.

On Windows, EXTERNAL authentication is not available,
so we continue to use the hard-coded default (all
authentication mechanisms are tried).

Users of tcp: or nonce-tcp: on Unix will have to comment
this out, but they would have had to use a special
configuration anyway (to set the listening address),
and the tcp: and nonce-tcp: transports are inherently
insecure unless special steps are taken to have them
restricted to a VPN or SSH tunnelling.

Users of obscure Unix platforms (those that trigger
the warning "Socket credentials not supported on this Unix OS"
when compiling dbus-sysdeps-unix.c) might also have to
comment this out, or preferably provide a tested patch
to enable credentials-passing on that OS.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agostart towards 1.8.20
Simon McVittie [Thu, 14 May 2015 13:30:08 +0000 (14:30 +0100)]
start towards 1.8.20

9 years ago1.8.18 sandbox/jacekbe/upstream
Simon McVittie [Thu, 14 May 2015 12:28:38 +0000 (13:28 +0100)]
1.8.18

9 years agodbus_daemon_publish_session_bus_address: Fix -Wsign-compare issue.
Ralf Habacker [Wed, 13 May 2015 18:17:05 +0000 (20:17 +0200)]
dbus_daemon_publish_session_bus_address: Fix -Wsign-compare issue.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90089
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>