Commit graph

4417 commits

Author SHA1 Message Date
Ralf Habacker
9a8a6e2882 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>
2015-10-27 13:15:23 +01:00
Simon McVittie
8991ccc3d4 1.10.3 2015-10-26 18:54:04 +00:00
Simon McVittie
1552a17fa4 1.10.2 2015-10-26 12:54:26 +00:00
Simon McVittie
dc8bb27099 Add a regression test for invalid BecomeMonitor calls
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92298
2015-10-26 12:46:55 +00:00
Simon McVittie
aec7bece68 NEWS 2015-10-26 12:05:09 +00:00
Jan Alexander Steffens (heftig)
98e4499240 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]
2015-10-26 11:59:36 +00:00
Simon McVittie
4eddd1bf52 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>
2015-10-26 11:57:35 +00:00
Simon McVittie
382cb17d37 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>
2015-10-22 17:35:59 +01:00
Ralf Habacker
12214344a2 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>
2015-10-21 13:26:16 +02:00
Simon McVittie
da0737e389 NEWS 2015-10-19 16:37:34 +01:00
Simon McVittie
7ee5f2b53a 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>
2015-10-19 16:06:50 +01:00
Simon McVittie
c99d733f37 NEWS 2015-10-02 11:51:40 +01:00
Simon McVittie
d0f4684138 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>
2015-10-02 11:24:05 +01:00
Simon McVittie
694d63b679 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>
2015-10-02 11:22:59 +01:00
Simon McVittie
54199f6903 NEWS 2015-09-30 15:49:06 +01:00
Milan Crha
171cdd50fb 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>
2015-09-30 15:36:37 +01:00
Ralf Habacker
36d864e469 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>
2015-09-20 13:48:28 +02:00
Simon McVittie
0a6310fe16 mention o.fd.DBus.Verbose in the NEWS too 2015-09-17 14:54:33 +01:00
Simon McVittie
cee466701d start towards 1.10.2 2015-08-25 19:34:54 +01:00
Simon McVittie
d2236978c0 1.10.0 2015-08-25 16:51:59 +01:00
Simon McVittie
8142d161f6 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>
2015-08-25 16:42:48 +01:00
Simon McVittie
0a0206d9a6 Distribute tap-test.sh.in unconditionally
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=91684
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
2015-08-25 16:42:15 +01:00
Simon McVittie
6dc7358aa4 1.9.21 2015-08-07 00:15:34 +01:00
Simon McVittie
6c2a16d16e Prepare 1.9.20 (1.10rc1) 2015-08-06 18:55:31 +01:00
Simon McVittie
267222b5d9 NEWS 2015-08-06 17:44:21 +01:00
Laurent Bigonville
992236f1c5 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>
2015-08-06 17:12:47 +01:00
Laurent Bigonville
517c4685a8 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>
2015-08-06 17:12:41 +01:00
Simon McVittie
2602ca61c5 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>
2015-08-06 17:12:40 +01:00
Simon McVittie
e3e388a1ef 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>
2015-08-06 17:12:37 +01:00
Simon McVittie
327a52e4eb 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>
2015-08-06 17:12:36 +01:00
Rolland Dudemaine
d0e9d8e7ba 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>
2015-08-06 14:03:16 +01:00
Simon McVittie
4bc250f96a 1.9.19 2015-07-21 21:13:43 +01:00
Simon McVittie
8f0e2e664e dbus-1.9.16 2015-07-21 17:52:21 +01:00
Simon McVittie
e5fd4c1473 dbus-1.8.20 2015-07-21 17:32:17 +01:00
Simon McVittie
dae42b370b Merge branch 'dbus-1.8'
Conflicts:
	.gitignore
	NEWS
	tools/dbus-monitor.c
2015-07-21 17:20:11 +01:00
Simon McVittie
e5ed2e2105 NEWS for 1.8.x 2015-07-21 17:19:25 +01:00
Simon McVittie
5d4900ad16 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 d9ee040d0b,
commit message adjusted to describe the impact in versions < 1.9)
Conflicts:
	tools/dbus-monitor.c
2015-07-21 17:18:08 +01:00
Simon McVittie
9c74286dee .gitignore: ignore /test-driver, generated by recent Automake
(cherry picked from commit 1895a8ee5b)
2015-07-21 17:17:05 +01:00
Simon McVittie
27a6538d5b 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]
2015-07-21 16:52:23 +01:00
Simon McVittie
d9ee040d0b 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>
2015-07-21 16:50:48 +01:00
Ralf Habacker
d10ac7c57e 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>
2015-07-13 14:33:32 +02:00
Simon McVittie
907c0b36e9 Merge branch 'dbus-1.8'
Conflicts:
	NEWS
2015-06-17 20:41:24 +01:00
Simon McVittie
1b892db6dd NEWS 2015-06-17 20:40:51 +01:00
Jacek Bukarewicz
b863c22f6a 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
2015-06-17 19:00:02 +01:00
Simon McVittie
54357a9692 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>
2015-06-17 16:06:53 +01:00
Simon McVittie
54f94fce08 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>
2015-06-17 16:06:39 +01:00
Simon McVittie
3b0a05b57c NEWS 2015-05-27 11:49:44 +01:00
Dimitri John Ledkov
70950325c7 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>
2015-05-27 11:49:41 +01:00
Dimitri John Ledkov
b2c61ca6ea 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>
2015-05-27 11:49:34 +01:00
Simon McVittie
4cbe3019c7 Start towards 1.9.18 2015-05-27 10:42:46 +01:00