Commit graph

77 commits

Author SHA1 Message Date
Ralf Habacker
0ee8a251ce Fix of 'warning: unused variable ‘result‘ [-Wunused-variable]'.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-04 12:32:53 +01:00
Simon McVittie
614e5aa872 Add a regression test for connecting to XDG_RUNTIME_DIR/bus by default
This test requires the unix:runtime=yes sub-transport from Bug #61303.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61301
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
2015-02-24 11:15:31 +00:00
Simon McVittie
2e6879bc1b Add regression test for LinuxSecurityLabel credential
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89041
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
2015-02-18 10:35:05 +00:00
Ralf Habacker
87d40ec950 Add test for windows sid.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-02-11 11:57:46 +00:00
Simon McVittie
94610d7de6 Add a common test_init() for GLib tests which prevents hanging forever
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46787
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
2015-02-04 17:15:36 +00:00
Simon McVittie
6a49ced2dd Add infrastructure to run bits of tests under an alternative uid
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:19:05 +00:00
Simon McVittie
8b238f3f0d Factor out some utility functions from test/dbus-daemon*
In the process, make test_kill_pid() safer: do not try to terminate
more than one pid, or the NULL handle.

Also stop leaking the address_fd in spawn_dbus_daemon, a pre-existing
bug that was spotted by Philip Withnall during review.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:18:57 +00:00
Simon McVittie
ae9d7149aa Merge branch 'dbus-1.8' and prepare 1.9.6
Conflicts:
	NEWS
	configure.ac
	test/dbus-daemon.c
2015-01-01 23:48:13 +00:00
Simon McVittie
4daf4bdc92 Add a regression test for path-based UpdateActivationEnvironment hardening
Reviewed-by: Thiago Macieira <thiago@kde.org>
2015-01-01 23:32:33 +00:00
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
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
Руслан Ижбулатов
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
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
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
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
Simon McVittie
c99a3df254 Merge branch 'dbus-1.4' 2011-08-12 10:26:13 +01:00
Simon McVittie
bc643f81a5 Fix compiler warnings when cross-compiling dbus-daemon test for mingw32
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40003
Reviewed-by: Colin Walters <walters@verbum.org>
2011-08-12 10:21:50 +01:00
Simon McVittie
0c4a2087c6 Remove various never-used variables
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39231
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-08-05 12:26:51 +01:00
Simon McVittie
63c93a1165 Add a regression test that can reproduce fd.o #34393
The number of messages is arbitrary; the more messages, the more likely
the crash is. 2000 messages seem to cause it reliably on this laptop,
but I've set it to 10000 to be safe.

Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34393
2011-07-28 18:23:52 +01:00
Simon McVittie
1250da8f7b Fix copyright dates
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
2011-06-10 18:33:22 +01:00
Simon McVittie
6ace0a5cbd Use DBUS_TIMEOUT_INFINITE in dbus-daemon.c
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
2011-06-10 18:33:20 +01:00
Simon McVittie
715fa5c0d5 Alter test-dbus-daemon so it tests the installed dbus-daemon by default
For installcheck, adjust it to use things from DESTDIR.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
2011-06-10 18:32:37 +01:00
Simon McVittie
ae5524d632 dbus-daemon test: sanity-check the just-installed config file when using DESTDIR
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
2011-06-10 18:32:06 +01:00
Simon McVittie
ba9c274f33 Add a simple integration test for dbus-daemon
This just pushes 2000 messages (or 100000 in performance-testing mode)
through the dbus-daemon, to an echo service and back.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
2011-06-10 18:32:02 +01:00