Commit graph

944 commits

Author SHA1 Message Date
Simon McVittie
ff068fea60 Add NetBSD to the list of platforms where credentials-passing a pid should work
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Patrick Welche <prlw1@cam.ac.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
Tested-by: Patrick Welche <prlw1@cam.ac.uk>
2014-11-06 14:29:50 +00:00
Simon McVittie
57e67fc551 test_processid: only assert that it works if we expect it to work
Otherwise, this would fail on, for instance, QNX.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Patrick Welche <prlw1@cam.ac.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
Tested-by: Patrick Welche <prlw1@cam.ac.uk>
2014-11-06 14:29:50 +00:00
Patrick Welche
f26ade306c Implement NetBSD credentials-passing with LOCAL_PEEREID
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
Tested-by: Patrick Welche <prlw1@cam.ac.uk>
2014-11-06 14:29:50 +00:00
Simon McVittie
fc2fa25a3f dbus-daemon test: don't assert we pass uid/pid on unknown Unix platforms
We know that Linux, FreeBSD and OpenBSD are "first class citizens"
for credentials-passing, with NetBSD not far behind: people have
turned up on the bug tracking system and told us that tests passed.
On other Unixes, we can't really assert that it works, until someone
who runs them tells us that it worked for them.

Additions to these lists are welcome.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Patrick Welche <prlw1@cam.ac.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
Tested-by: Patrick Welche <prlw1@cam.ac.uk>
2014-11-06 14:29:43 +00:00
Simon McVittie
2e4d069ac4 Stop asserting that we're not using the dummy lock implementation
That implementation no longer exists, so neither 0xABCDEF nor 0xABCDEF2
has any special meaning any more.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54972
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2014-10-29 14:12:38 +00:00
Simon McVittie
f541722f5a Use a better NoReply message for disconnection with reply pending
As an implementation detail, dbus-daemon handles this situation by
artificially triggering a timeout (even if its configured timeout for
method calls is in fact infinite). However, using the same debug message
for both is misleading, and can lead people who are debugging a service
crash to blame dbus-daemon instead, wasting their time.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=76112
2014-10-29 14:10:48 +00:00
Simon McVittie
c1b92aceee New test for fd-passing
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83622
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
[add dbus-sysdeps-unix.h as required for close-on-exec in master -smcv]
2014-09-17 17:20:07 +01:00
Simon McVittie
87448fed6f Make various system-bus-related things Unix-only
There is no system bus on Windows, and there won't be until/unless
it can be secure.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83583
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-09-15 13:33:21 +02:00
Simon McVittie
79c35a7d5a Merge branch 'dbus-1.8' 2014-09-15 11:51:26 +01:00
Simon McVittie
ae50d46ff2 On Linux, call prctl to disable core dumps
Whenever I forget to turn off corekeeper, the regression tests
take ages to record all test-segfault's crashes.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83772
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2014-09-15 11:50:48 +01:00
Ralf Habacker
89c6173706 Add directory test application 'manual-dir-iter' to cmake and autotools build system.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=57272
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-08 14:33:37 +00:00
Lukasz Skalski
980ef1d534 .gitignore: ignore incoming-limit.conf file
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=78977
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-06-11 11:14:05 +01:00
Руслан Ижбулатов
28812c885f Handle 0x0d0a EOLs in spawn_dbus_daemon()
On W32 dbus daemon will print output in text mode, with 0x0d0a EOLs instead
of just 0x0a. Be able to handle that.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=75863
Reviewed-by: Simon McVittie
2014-04-30 19:42:22 +01:00
Lukasz Skalski
9e7610ef17 Update .gitignore files
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=75833
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-03-06 13:10:56 +00:00
Ralf Habacker
7e373d4527 Rename bus-test-launch-helper to test-bus-launch_helper to match common test application naming scheme.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17 16:29:37 +00:00
Ralf Habacker
cf41239d66 Rename bus-test-system to test-bus-system to match common test application naming scheme.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17 16:29:37 +00:00
Ralf Habacker
3ce5d21edf Rename bus-test to test-bus to match common test application naming scheme.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17 16:29:37 +00:00
Ralf Habacker
54440baa21 Rename spawn-test to test-spawn to match common test application naming scheme.
[Same change as for shell-test in the previous commit. -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17 16:29:19 +00:00
Ralf Habacker
e782b0806e Rename shell-test to test-shell to match common test application naming scheme.
[Add its source file to SOURCES: this test was previously relying on the
Automake feature that the default value of foo_bar_SOURCES is foo-bar.c. -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17 16:28:39 +00:00
Ralf Habacker
0cd0714994 Rename dbus-test to test-dbus to match common test application naming scheme.
[reverted the dbus-specification part -smcv]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17 16:17:02 +00:00
Simon McVittie
7457a44011 tests: don't block and wait for a debugger on abort
In general, I think developers running the tests would expect
them to terminate rather than hanging. Developers who want to debug
such an abort by attaching a debugger to a live process can still set
DBUS_BLOCK_ON_ABORT in the environment.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-01-10 01:36:16 +01:00
Simon McVittie
e74f0b1efa test/dbus-daemon, test/dbus-daemon-eavesdrop: allow external dbus-daemon
It's easier to automate these tests if they launch their own
dbus-daemon, but easier to debug them if they don't: you can launch
a dbus-daemon separately, under gdb. However, tests that need a
specially-configured dbus-daemon will have to be skipped.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-01-07 23:02:18 +01:00
Ralf Habacker
710bd4a944 Skip unix only syslog test.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-06 21:38:39 +01:00
Simon McVittie
2d950f6e9a Make sure tests run with a temporary XDG_RUNTIME_DIR
We don't want the regression tests' "session" getting mixed up in
system-wide "sessions". This doesn't actually matter yet, but it is
likely to matter in future.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61301
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
[merged with earlier line-wrapping of TESTS_ENVIRONMENT -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-06 15:34:46 +00:00
Chengwei Yang
ec6ea1a6a8 DBusBabysitter: change executable to log_name
DBusBabysitter->executable is defined as executable name to use in error
messages. However, if servicehelper used, then the executable name is
servicehelper. It's not much help because we couldn't figure out which
service we're trying to activated if error happens.

In the following patch, we'll use service name to be activated as the
child log identifier and add a parameter to
_dbus_spawn_async_with_babysitter() to pass the log identifier.  Since
this is not the case in test, so executable changed to log_name.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68559
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-11-01 12:40:41 +00:00
Simon McVittie
880209788c $(in_data) is meant to contain the .in files
Reviewed-by: Colin Walters
2013-10-10 16:59:49 +01:00
Colin Walters
5618696768 test: Update build for previous commit
It should now be in in_data so we find it in $(srcdir).
2013-10-10 11:55:36 -04:00
Ralf Habacker
9f0366019d Use TEST_LISTEN in incoming-listen.conf.in instead of unix only hardcoded address
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68506
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-10 15:38:50 +02:00
Chengwei Yang
47df159cc5 Unify the way to find dbus-daemon test binary
There are two ways to find the dbus-daemon for testing. The first one is
defined as string at compile stage and the second one is export it from
test environment.

The first way has limitation that after defined, it's static string, so
it's impossible to run installable check. So let's unify to the second
way.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37849
[added missing "}" -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-08 16:08:57 +01:00
Simon McVittie
86c6dbd20b Don't assume that X11 autolaunch will work if DISPLAY is unset
In practice, it won't; other forms of autolaunch (like Mac OS launchd)
might, but we can't really assert either way.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40352
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
[amended to reinstate use of dbus/dbus-sysdeps.h which was removed
by 412538b3b9 -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-09-13 14:59:17 +01:00
Chengwei Yang
ee0f28f6a5 Use test binaries in build dir to do test
When do autolaunch testing, libdbus will try to start dbus-launch in
installed direcotry, if fail then fall back to dbus-launch in $PATH.
dbus-launch does a relative better thing to start dbus-daemon in build
directory, however, in most of case, the build $prefix is different from
the real prefix where dbus-daemon installed. So dbus-daemon will fail to
start due to can't find its config file. And then dbus-launch will fall
back to finally the installed dbus-daemon.

This patch fix this behavior and will start dbus-launch and dbus-daemon
in build directory in test environment.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37849
2013-09-13 14:29:45 +01:00
Chengwei Yang
0cea59aad5 Remove DBUS_COMPILATION from test source code
DBUS_COMPILATION definition was moved to test/Makefile.am static_cppflags,
so remove it from test source code.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-09-13 13:44:09 +01:00
Simon McVittie
50674ed689 Use GNU make features to reduce repetition
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48277
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
2013-09-05 13:56:36 +01:00
Simon McVittie
87df259d8c Add CPPFLAGS to "shared if possible" test binaries
In principle we ought to define DBUS_STATIC_BUILD in anything that's
using libdbus-internal.la (to avoid linking failures on
statically-linked mingw builds), and DBUS_TEST_USE_INTERNAL in any
test that's using the non-dbus-glib code paths of test-utils.[ch]
(to avoid the GLib requirement, although in practice, everything
"shared if possible" requires GLib at the moment anyway).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-05 12:35:29 +01:00
Simon McVittie
9d80d46a79 run-with-tmp-session-bus.sh: create a unique temporary file per process
This makes the regression tests OK to run in parallel.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-05 12:35:11 +01:00
Simon McVittie
30e7a81302 Tests: allow dbus-glib to be replaced with use of libdbus-internal
We only use dbus-glib for its main loop; within dbus, DBusLoop is
available as an alternative, although it isn't thread-safe and
isn't public API.

For tests that otherwise only use libdbus public API, it's desirable to
be able to avoid DBusLoop, so we can run them against an installed
libdbus as an integration test. However, if we don't have dbus-glib,
we're going to have to use an in-tree main loop, which might as well
be DBusLoop.

The major disadvantage of using dbus-glib is that it isn't safe to
link both dbus-1 and dbus-internal at the same time. This is awkward
for a future test case that wants to use _dbus_getsid() in dbus-daemon.c,
but only on Windows (fd.o #54445). If we use the same API wrapper around
both dbus-glib and DBusLoop, we can compile that test against dbus-glib
or against DBusLoop, depending on the platform.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-03 12:00:51 +01:00
Simon McVittie
f17fd1cc4e Define DBUS_COMPILATION externally for all tests that use internal stuff
It might as well go in the AM_CPPFLAGS rather than in the source code.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-03 12:00:44 +01:00
Simon McVittie
ce334cb0d6 corrupt test: close connection before releasing GSocket
GSocket takes responsibility for closing the fd, and there doesn't
seem to be any way to tell it not to. When this test is adapted to run
under DBusLoop as an alternative to dbus-glib, that becomes a problem,
because DBusLoop/DBusSocketSetEpoll do not tolerate that. Work around it.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-03 12:00:37 +01:00
Simon McVittie
412538b3b9 Export dbus_setenv() as a utility function
It's sufficiently portable that GLib has an equivalent, and I really
don't want to have to either open-code it in dbus-run-session or
link dbus-run-session statically. We have enough statically-linked
rubbish already.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39196
Reviewed-by: Colin Walters <walters@verbum.org>
2013-08-23 11:40:50 +01:00
Simon McVittie
e5f16e5716 Revert "Enable anonymous authorization for tests"
This reverts commit 22fc03d274.
2013-08-23 11:10:40 +01:00
Ralf Habacker
5fcba306d9 Manual rebase fix. 2013-08-23 03:10:15 +02:00
Simon McVittie
71cfa9cdd0 Add a test-case for trying to connect with the wrong GUID
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39720
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 03:03:30 +02:00
Simon McVittie
9c0a70f5a3 Add a simple manual test for authentication/authorization.
Bug: http://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-23 02:57:50 +02:00
Cosimo Alfarano
22fc03d274 Enable anonymous authorization for tests
Now that authorization is in SASL mechs, enable anonymous authorizations
when we are testing anonymous mechs functionality

Bug: http://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 01:48:23 +02:00
Simon McVittie
4b63567c02 GetConnectionCredentials: add
The initial set of credentials is just UnixUserID and ProcessID.
The rest can follow when someone is sufficiently interested to actually
test them.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[rename a function that Ralf found unclear -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-22 18:21:58 +01:00
Colin Walters
2de11abd56 test/marshal: Ensure we use suitably aligned buffers
This test was failing on s390; though it could fail
on other platforms too.  Basically we need to be sure
we're passing at least word-aligned buffers to the
demarshalling code.  malloc() will do that for us.

https://bugs.freedesktop.org/show_bug.cgi?id=67279
2013-07-24 17:52:58 -04:00
Chengwei Yang
134701b758 tests to embedded tests: replaced in automake files
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66291
2013-06-28 12:17:15 +01:00
Simon McVittie
2b3272c75a Make taking a global lock automatically initialize locking if needed
This lets them be thread-safe by default, at the cost that they can
now fail.

init_uninitialized_locks() and init_global_locks() must now both
reimplement the equivalent of _dbus_register_shutdown_func(), by using
_dbus_platform_rmutex_lock() on the same underlying mutex around a call
to _dbus_register_shutdown_func_unlocked().

This is because if they used the usual _DBUS_LOCK() API (as
_dbus_register_shutdown_func() does), it would automatically try to
initialize global locking, leading to infinite recursion.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54972
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
Reviewed-by: Anas Nashif <anas.nashif@intel.com>
2013-06-17 17:00:00 +01:00
Simon McVittie
51fe1c05ac Merge branch 'dbus-1.6'
Conflicts:
	NEWS
	configure.ac
2013-06-12 14:49:37 +01:00
Simon McVittie
2420f7ae8b Add a test-case for CVE-2013-2168
Reviewed-by: Thiago Macieira <thiago@kde.org>
[build system adjusted to compile it even if we don't have GLib -smcv]
2013-06-12 13:56:39 +01:00