Commit graph

4417 commits

Author SHA1 Message Date
Simon McVittie
384c924c77 Revert "Replace $DBUS_USE_TEST_BINARY with $DBUS_TEST_DBUS_LAUNCH"
This reverts commit 8fd2be6013.
This change was intended for 1.11.
2016-02-12 15:25:15 +00:00
Simon McVittie
9843c724c6 Revert "name-test C tests: produce structured (TAP) output"
This reverts commit fec99c9b3d.
This change was intended for 1.11.
2016-02-12 15:25:13 +00:00
Simon McVittie
c285a053d6 Revert "name-test: run most C tests directly, not via run-test.sh"
This reverts commit d893121efd.
This change was intended for 1.11.
2016-02-12 15:25:12 +00:00
Simon McVittie
1aa36b48cc Revert "Rename function string_array_length() to _dbus_string_array_length() and move it to dbus-internals.c."
This reverts commit 1370b44035.
This change was intended for 1.11.
2016-02-12 15:25:09 +00:00
Simon McVittie
554dba974c Revert "Add new functions _dbus_hash_table_to_array() and _dbus_hash_table_from_array() from related activation code."
This reverts commit 610ff8d964.
This change was intended for 1.11.
2016-02-12 15:24:55 +00:00
Ralf Habacker
610ff8d964 Add new functions _dbus_hash_table_to_array() and _dbus_hash_table_from_array() from related activation code.
These functions are required for dbus-run-session.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-02-11 23:43:09 +01:00
Ralf Habacker
1370b44035 Rename function string_array_length() to _dbus_string_array_length() and move it to dbus-internals.c.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-02-11 02:41:12 +01:00
Simon McVittie
d893121efd name-test: run most C tests directly, not via run-test.sh
The exception is test-autolaunch, which is really not particularly
useful as a build-time test. The only way we can really test
autolaunch is as a whole-system integration test, and "make check"
is not that.

The two tests written in Python and one test based on dbus-send
are also not run directly yet; in particular, that includes both
the tests in run-test-systemserver.sh.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-11 02:37:17 +01:00
Simon McVittie
fec99c9b3d name-test C tests: produce structured (TAP) output
Similar to commit 58eefa1031.

test-privserver is a helper executable, not a test. I moved its output
from stdout to stderr so it can't be misinterpreted as the test's
stdout.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-11 02:37:14 +01:00
Simon McVittie
8fd2be6013 Replace $DBUS_USE_TEST_BINARY with $DBUS_TEST_DBUS_LAUNCH
Instead of using $DBUS_USE_TEST_BINARY to control whether to use the
hard-coded test binary TEST_BUS_LAUNCH_BINARY, we can just use
$DBUS_TEST_DBUS_LAUNCH to control what we launch directly, as we
were already doing for $DBUS_TEST_DAEMON.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-11 02:37:11 +01:00
Nick Lewycky
b065413b0e marshal-validate: run all the tests instead of just the even ones
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93908
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
[smcv: Re-enable the failing test that Nick disabled, and fix the
expected result; the result given by our current implementation is
reasonable.]
2016-02-08 17:43:50 +00:00
Simon McVittie
96ffc2a07e configure.ac: support large-file for stat64
dbus-daemon is not expected to open files with large *sizes*, but without
large file support, calling [f]stat() on a file that happens to have a
large inode number will fail with EOVERFLOW (see stat(2)). For example,
files mounted from an NFS server might have large inode numbers.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93545
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
[smcv: shorten and clarify commit message; move AC_SYS_LARGEFILE
after AC_USE_SYSTEM_EXTENSIONS because nothing should compile C before
that point]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-02-08 17:25:38 +00:00
Simon McVittie
7eb34fc2cd test/name-test/run-test.sh: output correct result if a C test fails
Loosely based on a patch from amit tewari.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93379
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-01-25 15:05:49 +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
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
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
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
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
Ralf Habacker
034b462fd4 Skip launch helper activation tests on windows silently.
The system bus is unsupported there and Windows does not
have any concept of setuid binaries, so it can't ever
actually work.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-12 12:49:46 +01:00
Ralf Habacker
b4cb853e91 Fix memory leak in _dbus_win_set_error_from_win_error().
There is no need to make a local (leaked) copy of the message,
because dbus_set_error() already makes a copy of its parameters.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-11 15:02:44 +01:00
Ralf Habacker
52e97d76a6 Fix memory leaks in bus_activation_service_reload_test() in case of errors.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-11 15:02:00 +01:00
Ralf Habacker
1ca1bd2c53 Revert "Fix memory leaks in bus_activation_service_reload_test() in case of errors."
This reverts commit d8569ac647.
2015-11-11 15:01:11 +01:00
Ralf Habacker
d8569ac647 Fix memory leaks in bus_activation_service_reload_test() in case of errors.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: https://bugs.freedesktop.org/show_bug.cgi?id=92721
2015-11-11 13:44:41 +01:00
Ralf Habacker
dcdb29a105 Fix test-bus segfault_service_no_auto_start test on windows.
Windows returns unhandled exceptions from a running child
by specific exit codes and not by signals as on UNIX.

Therefore we use DBUS_ERROR_SPAWN_CHILD_EXITED for propagating
unhandled exceptions to the parent too.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-11-11 12:20:07 +01:00
Simon McVittie
e2e3179492 update NEWS 2015-11-06 18:26:40 +01:00
Ralf Habacker
e48d40c582 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>
2015-11-06 17:54:15 +01:00
Ralf Habacker
15e0bba3f8 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>
2015-11-06 17:53:29 +01:00
Ralf Habacker
008264ff55 Compile fix on Windows.
This commit fixes a regression introduced with commit 04b8a7a772.
2015-11-04 14:23:27 +01:00
Ralf Habacker
04b8a7a772 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>
2015-11-03 14:23:22 +01:00
Ralf Habacker
34d0c73f99 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]
2015-11-03 14:22:30 +01:00
Simon McVittie
78545a32c5 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>
2015-11-02 23:32:06 +01:00
Simon McVittie
2f1a715e7f 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>
2015-11-02 23:24:11 +01:00
Simon McVittie
50b07fbb01 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>
2015-11-02 23:22:42 +01:00
Ralf Habacker
d774aa9561 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>
2015-11-02 21:22:26 +01:00
Ralf Habacker
b8a5cad10b 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>
2015-11-02 21:20:27 +01:00
Simon McVittie
6e8f9c35e6 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]
2015-10-29 06:35:44 +01:00
Simon McVittie
24342d5912 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>
2015-10-29 05:50:27 +01:00
Ralf Habacker
24b6eecc66 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>
2015-10-27 13:52:10 +01:00