Commit graph

25 commits

Author SHA1 Message Date
Simon McVittie
9d60676ae0 Disable the Containers interface
We've had a request for a 1.14.x stable-branch, but the Containers
interface is only partially implemented, not yet described in the
D-Bus Specification, and not ready to be part of our API guarantees.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-12-10 16:48:51 +00:00
Simon McVittie
c2ee90375a containers test: Wait a few more seconds for the socket to be deleted
Previously, we were waiting a few seconds for the dbus-daemon to stop
listening, then trying to connect again and asserting that it failed,
then immediately asserting that the socket had actually been deleted.
However, there is a race here: the dbus-daemon stops listening on the
socket, and then deletes it. If the test client wins the race by
probing to see whether the socket is present after the dbus-daemon
has stopped listening but before the dbus-daemon has deleted it, then
the test will fail.

This intermittently happens on Gitlab-CI, most recently in
<https://gitlab.freedesktop.org/smcv/dbus/-/jobs/45694>.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-11-19 13:53:52 +00:00
Simon McVittie
488ed14cc0 containers test: Exercise GetConnectionInstance() on dbus-daemon itself
This is an easy bit of missing test coverage detected by running the
test suite with gcov.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107739
2018-08-30 17:39:37 +01:00
Simon McVittie
8177bbcf52 tests: Detach most connections from main loop before closing
We don't need to do this for connections that were never set up
with the main loop.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107194
2018-08-02 17:16:43 +01:00
Simon McVittie
620406f757 test/containers: Fix some memory leaks
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107194
2018-08-02 17:16:27 +01:00
Simon McVittie
e95dc1d58f tests: Call dbus_shutdown()
Not all of these tests will be fully valgrind-clean yet (or perhaps
ever), but it's easier to add this to all of them than to think
about it.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107194
2018-08-02 17:14:39 +01:00
Simon McVittie
b387bd4d29 containers test: Record the unconfined manager connection's unique name
This is a bit more convenient than fetching it as-needed.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105656
2018-06-21 17:43:52 +01:00
Simon McVittie
3837cd4d8a containers test: Factor out fixture_disconnect_observer
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105656
2018-06-21 17:43:48 +01:00
Simon McVittie
d26639ecc2 containers test: Factor out disconnecting the unconfined manager
As this test's coverage expands, this function will have to do more
(clear up name watches, filters, etc.) so it'll be helpful to keep it
all in one place.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105656
2018-06-21 17:43:46 +01:00
Simon McVittie
eaaa2b67e4 containers test: Move teardown below all test-cases
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105656
2018-06-21 17:43:40 +01:00
Simon McVittie
2154504764 Avoid -Wunused-function for iterate_both_main_loops() without containers
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-03-01 18:15:59 +00:00
Simon McVittie
1d1ba5059c test/containers: Test the new header field
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101899
2018-02-16 15:28:06 +00:00
Simon McVittie
1086acbd79 containers: Include credentials of initiator in container instance info
This provides the necessary information for services to make an
informed decision about how far they should trust the container type,
name and metadata fields.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104610
2018-01-15 14:00:52 +00:00
Simon McVittie
2b60ee640c test/containers: Don't require type, name in GetConnectionCredentials
On the session bus, the container type and name might be
uncontroversial, but on the system bus, it's questionable how far
they can be trusted: they're supplied by the initiator of the
per-container server, so we only have their word for it.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104610
2018-01-15 12:28:01 +00:00
Simon McVittie
c04e52cd61 test/containers: Exercise the resource limits
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-12 16:22:35 +00:00
Simon McVittie
5be6ca4163 test/containers: Check that GetInstanceInfo stops working
After the container instance is removed, the method should not work.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-12 16:22:35 +00:00
Simon McVittie
df2913a598 t/containers: Exercise trivial and non-trivial container metadata
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-12 16:22:34 +00:00
Simon McVittie
2c49262057 test/containers: Check that connections from containers are unprivileged
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-12 16:22:34 +00:00
Simon McVittie
6537b583f6 test/containers: Check that containers can't make new containers
We should prevent containers from trying to put a container in our
container so we can sandbox while we sandbox. The implementation doesn't
actually have any concept of nesting or layering, so that would potentially
be privilege escalation.

At the moment, this is just prevented by METHOD_FLAG_PRIVILEGED. When we
remove that flag (after we've introduced better resource limits), we can
specifically restrict this method to not be called by containers
instead. This test will make sure we do.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-12 16:22:34 +00:00
Simon McVittie
1de35ba8ee test/containers: Assert that InstanceRemoved is emitted
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-12 16:22:34 +00:00
Simon McVittie
4208e47f38 test/containers: Exercise the various ways to stop a container
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-12 16:22:34 +00:00
Simon McVittie
c3851f28e9 test/containers: Exercise connecting to the new socket as the wrong uid
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-12 16:22:34 +00:00
Simon McVittie
db6ba2d799 test/containers: Exercise a successful call to AddServer
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-12 16:22:29 +00:00
Simon McVittie
e65d6cf1ef test/containers: Exercise the new parameter checking
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-11 15:50:31 +00:00
Simon McVittie
3d2028dfe0 test/containers: New test
So far it only exercises SupportedArguments.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-11 15:50:31 +00:00