Commit graph

4464 commits

Author SHA1 Message Date
Simon McVittie
b21093478a embedded tests: accept and ignore --tap argument
This makes them semi-command-line-compatible with a way we can
invoke the GLib-based tests to get more useful debug logs.

These tests still do not actually produce TAP output yet; I tried
implementing that, but it requires changing a lot of noise on stdout
to come out of stderr, and there was something weird going on with
subprocesses restarting the test numbering which will need further
investigation before making that change.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02 00:53:00 +01:00
Simon McVittie
4ddf4be03c cmake: copy the systemd-activation directory too
It is needed for a couple of test-cases.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02 00:53:00 +01:00
Simon McVittie
90a5da3a05 cmake: manual-tcp is not an automated test
Don't run it when we run automated tests.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02 00:53:00 +01:00
Simon McVittie
3294b7a729 Avoid -Wunused-label when compiling with libselinux but no libaudit
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02 00:53:00 +01:00
Ralf Habacker
33b0afa102 Add linking to dbghelp for autotools on Windows which is required for backtrace generator.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-12-01 22:03:25 +00:00
Laurent Bigonville
a3a5935a0a Initialize SELinux and Apparmor after capabilities are set
avc_init() in the SELinux code path is creating a new thread, we need to
set to capabilities before it gets created so it has the permission to
send audit messages.

It also make more sense to open the audit netlink before the different
logging callbacks are set.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92832
[smcv: add comments explaining why initialization must happen in this
specific order]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-12-01 22:02:10 +00:00
Simon McVittie
1fcb37d0a3 Merge branch 'dbus-1.10' 2015-12-01 21:37:48 +00:00
Simon McVittie
e18b4eb14c 1.10.7 2015-12-01 21:36:02 +00:00
Simon McVittie
7d3b2b1cbe 1.10.6 2015-12-01 18:19:17 +00:00
Simon McVittie
420f3474ed Do not attempt to call child_setup on Windows
child_setup() is defined to be called after fork() and before exec(),
but Windows' process model does not have fork(): the equivalent of
those two operations is a single CreateProcess() call. This means
that there is no point at which we could call child_setup() and
have it affect only the child's process-global state. At the point
where it is currently executed, it affects the parent's process-global
state instead, which would be actively harmful if we used any
child_setup() function that was not a no-op on Windows.

The equivalent function in GLib, g_spawn_async_with_pipes(), documents
child_setup() as unused on Windows. Do the same here.

In practice, our only use of child_setup() outside tests
is #ifdef DBUS_UNIX anyway, so this change has no practical effect
right now.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85857
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-11-27 10:03:06 +00:00
Ralf Habacker
7c7f4a5110 Workaround with infinite loop while walking along the stack frames on wine64.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-24 13:46:50 +01:00
Ralf Habacker
90b751c282 Add x86_64 support to backtrace generator on windows.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-24 13:40:33 +01:00
Ralf Habacker
8a29ea406d Refactor windows backtrace generator to link directly to dbghelp shared library.
Also use SymFromAddr() instead of deprecated SymGetSymFromAddr()
as suggested on MSDN; fix some indention issues.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-24 13:38:44 +01:00
Ralf Habacker
5b79b0fac2 Add file and line support to backtrace generator on windows.
Remaining issues are fixed in the next commit.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-24 13:35:41 +01:00
Ralf Habacker
e803cf1644 Fix warning: "pointer targets in passing argument 1 of '_mbsrchr' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-24 12:28:21 +01:00
Ralf Habacker
8d83e4da18 Fix warning: "pointer targets in passing argument 3 of 'CryptGenRandom' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-24 12:27:42 +01:00
Ralf Habacker
5feb0223a2 Fix warning: "pointer targets in passing argument 2 of '_dbus_unpack_uint32' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-24 12:26:00 +01:00
Ralf Habacker
d2b8b8611e Fix warning: "pointer targets in assignment differ in signedness [-Wpointer-sign]".
The warnings are fixed by adding functions to dbus string name
space returning unsigned char pointer, which avoids the need to
use casts.

Bug: https://bugs.freedesktop.org/attachment.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-24 12:26:00 +01:00
Simon McVittie
0ccafbd173 NEWS for 1.11 2015-11-23 21:30:29 +00:00
Simon McVittie
66c15a41b6 Merge branch 'dbus-1.10' 2015-11-23 21:30:21 +00:00
Simon McVittie
50fb01027b NEWS for 1.10 branch 2015-11-23 21:10:09 +00:00
Simon McVittie
edb1e57260 uid-permissions test: don't assert that root can UpdateActivationEnvironment
Since 1.10.4 this is hard-coded to be disallowed when an activation
helper is used. That would be a security flaw waiting to happen,
and makes little sense anyway, because the activation helper sanitises
its environment.

Use BecomeMonitor() instead, as our way to assert that root and
messagebus are privileged.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93036
Reviewed-by: Iain Lane
2015-11-23 20:59:48 +00:00
Ralf Habacker
db2af882ef Fix warning: "pointer targets in passing argument 2 of '_dbus_string_append_len' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/attachment.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-23 17:18:57 +01:00
Ralf Habacker
f5f98a1189 Fix warning: "pointer targets in passing argument 1 of '_dbus_verbose_bytes' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/attachment.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-23 17:13:40 +01:00
Ralf Habacker
dd75ab9531 Fix warning: "pointer targets in passing argument 1 of 'check_sha_binary' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/attachment.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-23 14:50:24 +01:00
Ralf Habacker
9ef8f69ab0 Fix warning: "pointer targets in passing argument 3 of 'pack_[248]_octets' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/attachment.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-23 14:44:30 +01:00
Ralf Habacker
79b6a353eb Fix warning: "pointer targets in passing argument 3 of 'dbus_connection_get_adt_audit_session_data' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/attachment.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-23 14:41:26 +01:00
Ralf Habacker
a804fd2dbc Fix warning: "pointer targets in passing argument 4 of 'marshal_len_followed_by_bytes' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/attachment.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-23 14:40:20 +01:00
Ralf Habacker
db495bbcf3 Fix warning: "pointer targets in passing argument 2 of '_dbus_string_init_const_len' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/attachment.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-23 14:34:32 +01:00
Ralf Habacker
048564bc14 Fix warning: "pointer targets in passing argument 5 of 'byteswap_body_helper' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/attachment.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-23 14:34:32 +01:00
Ralf Habacker
8dd04cb4b2 Fix several -Wpointer-sign warnings in test_hex_roundtrip() and related types.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-23 13:27:26 +01:00
Simon McVittie
f3be583b40 monitor: use the addressed_recipient to select matches
This means we respect the destination keyword in arguments to
BecomeMonitor.

In bus_dispatch(), this means that we need to defer capturing until
we have decided whether there is an addressed recipient; so instead
of capturing once, we capture at each leaf of the decision tree.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92074
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Reviewed-by: Lars Uebernickel <lars@uebernic.de>
2015-11-17 20:53:08 +00:00
Simon McVittie
6c0c7ce255 name-test: don't run these tests with autotools if targeting Windows.
The wrapper shell script that sets up their environment is nowhere
near being portable. In particular, it uses dbus-run-session,
which is Unix-specific.

[rh: Add autotools scope in commit title]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Rewieved-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-11-17 21:09:47 +01:00
Simon McVittie
0bcc5d58da Windows _dbus_get_autolaunch_address: don't leak shm_name
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-11-18 23:40:50 +01:00
Simon McVittie
d8c02f85bc 1.10.5 2015-11-17 23:46:34 +00:00
Simon McVittie
73ff1f6d9f dbus 1.10.4 2015-11-17 21:40:36 +00:00
Simon McVittie
d42b8fa670 NEWS 2015-11-17 18:22:37 +00:00
Jan Alexander Steffens (heftig)
cc37dc857f bus-driver: Support returning org.freedesktop.DBus UID and PID
Attempting to call SetEnvironment on systemd causes it to inquire
about the caller's connection UID and PID. If this check fails,
the call is rejected.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92857
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
[smcv: go back to DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN as the error code
for failure to determine the pid]
2015-11-17 18:21:44 +00:00
Jan Alexander Steffens (heftig)
6e63e23983 test/sd-activation: Test UpdateActivationEnvironment forwarding
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92857
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-17 18:21:26 +00:00
Jan Alexander Steffens (heftig)
a5c46b4ae4 bus_driver_handle_update_activation_environment: Forward to systemd
If we use systemd activation, forward all UpdateActivationEnvironment
requests to org.freedesktop.systemd1.Manager.SetEnvironment, in order
to ensure variables needed by D-Bus services are available when these
services are launched by systemd.

Since UpdateActivationEnvironment is not available on the system bus,
this only applies to user buses.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92857
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-17 18:21:22 +00:00
Jan Alexander Steffens (heftig)
4f116d7865 bus_driver_handle_update_activation_environment: Error on system buses
The default policy already disallows calls on system buses. Since any
bus with a service helper cleans the environment anyway, there's no
point in allowing this to be called.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92857
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-17 18:21:10 +00:00
Simon McVittie
a12c9cebb7 manual-backtrace: use proper prototypes, and make functions static
Otherwise this will fail to compile with our default Autotools
compiler warnings.
2015-11-17 15:32:43 +00:00
Simon McVittie
a7cc817895 Merge branch 'dbus-1.10' 2015-11-17 15:28:50 +00:00
Simon McVittie
32f966b908 fdpass test: assert that TCP connections don't say they can pass fds
As well as slightly increasing our test coverage, this ensures
that at least one test-case in this test is not skipped, working
around CMake's lack of support for the Automake-style exit code
produced by GTest executables (they exit 77 if everything was skipped).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92887
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-11-17 14:48:23 +01:00
Ralf Habacker
5ce3b93c71 Add backtrace test app.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-17 14:30:54 +01:00
Ralf Habacker
ab28e34983 Print stack index in backtrace generator on Windows.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-17 13:48:55 +01:00
Ralf Habacker
bc5ae92652 Merge branch 'dbus-1.10' 2015-11-16 14:22:23 +01:00
Ralf Habacker
d00bbd9711 Fix recursive loop in backtrace generator on windows.
Backtrace generator called _dbus_warn(), which calls
backtrace generator recursively with DBUS_FATAL_WARNINGS=1.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-16 14:20:08 +01:00
Ralf Habacker
543d855021 Do not fail with fatal message skipping GetConnectionUnixProcessID test-bus test on windows.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-13 23:02:57 +01:00
Ralf Habacker
19a0c97d55 Fix test-bus test for GetConnectionUnixUser driver method on windows.
Because GetConnectionUnixUser is not supported on windows it fails with
DBUS_ERROR_FAIL.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-13 23:02:45 +01:00