]> git.ipfire.org Git - thirdparty/dbus.git/log
thirdparty/dbus.git
7 years agoDBusPendingCall: Only update ->completed under the connection lock
Manish Narang [Thu, 25 Jan 2018 11:39:44 +0000 (11:39 +0000)] 
DBusPendingCall: Only update ->completed under the connection lock

If one thread is blocking on a pending call, and another thread is
dispatching the connection, then we need them to agree on the value
of the completed flag by protecting all accesses with a lock. Reads
for this member seem to have the connection lock already, so it's
sufficient to make sure that the only write also happens under the
connection lock.

We already set the completed flag before calling the callback, so it
seems OK to stretch it to meaning that some thread has merely *taken
responsibility for* calling the callback.

The completed flag shares a bitfield with timeout_added, but that
flag is protected by the connection lock already.

Based on suggestions from Simon McVittie on
<https://bugs.freedesktop.org/show_bug.cgi?id=102839>.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=102839
[smcv: Revert indentation changes; add commit message]
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoDBusConnection: Pass a pending call around more often
Manish Narang [Thu, 25 Jan 2018 11:39:44 +0000 (11:39 +0000)] 
DBusConnection: Pass a pending call around more often

If a pending call is provided, _dbus_connection_do_iteration_unlocked
checks whether it has completed or has a reply ready as soon as it
acquires the I/O path. If that's the case, then the iteration
terminates without trying to carry out I/O, so that the pending call
can be dispatched immediately, without blocking until a timeout is
reached. This change is believed to be necessary, but not sufficient,
to resolve #102839.

Based on part of a patch from Michael Searle on
<https://bugs.freedesktop.org/show_bug.cgi?id=102839>.
Commit message added by Simon McVittie.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=102839
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoStart developing spec v0.33
Simon McVittie [Thu, 1 Feb 2018 18:42:06 +0000 (18:42 +0000)] 
Start developing spec v0.33

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoRelease spec v0.32
Simon McVittie [Tue, 30 Jan 2018 15:30:52 +0000 (15:30 +0000)] 
Release spec v0.32

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoNEWS: Mention systemd < 237 here too
Simon McVittie [Mon, 29 Jan 2018 12:01:09 +0000 (12:01 +0000)] 
NEWS: Mention systemd < 237 here too

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotmpfiles: Add a note that one line is not needed with newer systemd
Simon McVittie [Mon, 29 Jan 2018 11:59:40 +0000 (11:59 +0000)] 
tmpfiles: Add a note that one line is not needed with newer systemd

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotravis-ci: Get autoconf-archive from Debian 9 'stretch'
Simon McVittie [Mon, 29 Jan 2018 10:45:43 +0000 (10:45 +0000)] 
travis-ci: Get autoconf-archive from Debian 9 'stretch'

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years ago_dbus_credentials_add_from_user: Check return of add_unix_uid
Simon McVittie [Tue, 16 Jan 2018 12:23:06 +0000 (12:23 +0000)] 
_dbus_credentials_add_from_user: Check return of add_unix_uid

Coverity CID 253543.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
7 years agoFix unterminated Automake conditional
Simon McVittie [Mon, 15 Jan 2018 20:09:02 +0000 (20:09 +0000)] 
Fix unterminated Automake conditional

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agodbus-spawn-unix: Rename from dbus-spawn
Simon McVittie [Mon, 15 Jan 2018 14:14:29 +0000 (14:14 +0000)] 
dbus-spawn-unix: Rename from dbus-spawn

This file is the Unix counterpart of dbus-spawn-win.c, so it's less
confusing for it to have an indicative name.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588

7 years agodbus-spawn.c: Eliminate trailing whitespace
Simon McVittie [Mon, 15 Jan 2018 14:12:33 +0000 (14:12 +0000)] 
dbus-spawn.c: Eliminate trailing whitespace

Otherwise the pre-commit hook won't let me rename 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=104588

7 years agoClarify which files are Unix-specific
Simon McVittie [Fri, 12 Jan 2018 14:09:59 +0000 (14:09 +0000)] 
Clarify which files are Unix-specific

dbus-spawn.c and dbus-userdb* don't have obviously-Unix-specific names,
but are Unix-specific anyway.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588

7 years agoNEWS for #104588
Simon McVittie [Mon, 15 Jan 2018 14:53:30 +0000 (14:53 +0000)] 
NEWS for #104588

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotest: Add a test-case for EXTERNAL auth rejecting usernames
Simon McVittie [Fri, 12 Jan 2018 16:52:58 +0000 (16:52 +0000)] 
test: Add a test-case for EXTERNAL auth rejecting usernames

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588

7 years agotest: Add a test for authenticating with an empty authorization identity
Simon McVittie [Fri, 12 Jan 2018 16:50:20 +0000 (16:50 +0000)] 
test: Add a test for authenticating with an empty authorization identity

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588

7 years agoDBusAuthScript: Make USERNAME_HEX differ from USERID_HEX
Simon McVittie [Fri, 12 Jan 2018 16:47:55 +0000 (16:47 +0000)] 
DBusAuthScript: Make USERNAME_HEX differ from USERID_HEX

Previously, USERID_HEX and USERNAME_HEX were both replaced by the hex
encoding of the numeric uid, something like 31303030 for "1000".
Now USERNAME_HEX is something like 736d6376 for "smcv". This is only
supported on Unix, but no authentication mechanisms use usernames on
Windows anyway.

This would require changing the tests that make use of USERNAME_HEX
if we had any, but we currently don't.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588

7 years ago_dbus_credentials_add_from_user: Only accept numeric uid for EXTERNAL
Simon McVittie [Fri, 12 Jan 2018 16:09:08 +0000 (16:09 +0000)] 
_dbus_credentials_add_from_user: Only accept numeric uid for EXTERNAL

In the well-known system dbus-daemon, it's desirable to avoid looking
up non-numeric authorization identities in the user database, because
that could deadlock with NSS modules that directly or indirectly
require the system bus. Add a flag for whether the username will be
looked up in the userdb, and don't set that flag for EXTERNAL auth
(which is what we use on the system bus, and on the session bus
if not configured otherwise).

DBUS_COOKIE_SHA1 authentication is documented in terms of the
username (although in fact libdbus sends a numeric uid there too,
and GDBus only accepts a numeric uid) so continue to use the userdb
for that mechanism. DBUS_COOKIE_SHA1 needs to use the userdb on Unix
anyway, otherwise it won't find the user's home directory.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588

7 years ago_dbus_credentials_add_from_user: Add proper error reporting
Simon McVittie [Fri, 12 Jan 2018 16:06:22 +0000 (16:06 +0000)] 
_dbus_credentials_add_from_user: Add proper error reporting

While I'm changing its signature anyway, I might as well fix a
long-standing FIXME.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588

7 years ago_dbus_credentials_add_from_user: Add a fast-path for numeric strings
Simon McVittie [Fri, 12 Jan 2018 14:22:23 +0000 (14:22 +0000)] 
_dbus_credentials_add_from_user: Add a fast-path for numeric strings

The very common case for this function is that during AUTH EXTERNAL,
it receives a Unix uid encoded as an ASCII decimal integer. There is
no need to look up such uids in the system's user database
(/etc/password or NSS) when the only information we are going to use
from the DBusUserInfo struct is the uid anyway. This avoids taking
the lock and performing a potentially time-consuming NSS lookup.

This changes behaviour in one corner case: if a privileged process has
used one of the set*uid family of functions to set its effective uid
to a numeric uid that does not exist in the system's user database,
we would previously fail. Now, we succeed anyway: it is true to say
in the DBusCredentials that the process has uid 12345, even if uid
12345 does not correspond to any named user.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588

7 years agocontainers: Include credentials of initiator in container instance info
Simon McVittie [Fri, 12 Jan 2018 19:55:41 +0000 (19:55 +0000)] 
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

7 years agodriver: Factor out bus_driver_fill_connection_credentials
Simon McVittie [Wed, 10 Jan 2018 15:36:55 +0000 (15:36 +0000)] 
driver: Factor out bus_driver_fill_connection_credentials

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

7 years agobus driver: Omit container type, name from GetConnectionCredentials
Simon McVittie [Wed, 10 Jan 2018 15:01:33 +0000 (15:01 +0000)] 
bus driver: Omit container type, name from 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. While we
think about what to do about this, remove them, leaving only the
instance (which can be used to look up the rest).

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

7 years agotest/containers: Don't require type, name in GetConnectionCredentials
Simon McVittie [Wed, 10 Jan 2018 15:00:41 +0000 (15:00 +0000)] 
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

7 years agoUpdate NEWS for #100317
Simon McVittie [Thu, 11 Jan 2018 18:45:56 +0000 (18:45 +0000)] 
Update NEWS for #100317

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoheader-fields test: Assert that we can remove multiple unknown fields
Simon McVittie [Tue, 19 Dec 2017 19:21:16 +0000 (19:21 +0000)] 
header-fields test: Assert that we can remove multiple unknown fields

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agospec: Document the design principle that new headers must be asked for
Simon McVittie [Tue, 12 Dec 2017 15:36:36 +0000 (15:36 +0000)] 
spec: Document the design principle that new headers must be asked for

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agotests: Assert that dbus-daemon filters unknown header fields
Simon McVittie [Tue, 12 Dec 2017 14:05:20 +0000 (14:05 +0000)] 
tests: Assert that dbus-daemon filters unknown header fields

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agodbus-daemon: Filter out unknown header fields
Simon McVittie [Tue, 12 Dec 2017 14:05:04 +0000 (14:05 +0000)] 
dbus-daemon: Filter out unknown header fields

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoheader-fields test: Exercise _dbus_message_remove_unknown_fields
Simon McVittie [Tue, 12 Dec 2017 14:04:47 +0000 (14:04 +0000)] 
header-fields test: Exercise _dbus_message_remove_unknown_fields

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years ago_dbus_message_remove_unknown_fields: Add
Simon McVittie [Tue, 12 Dec 2017 14:04:04 +0000 (14:04 +0000)] 
_dbus_message_remove_unknown_fields: Add

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoAdd a test for header fields
Simon McVittie [Mon, 27 Nov 2017 15:51:15 +0000 (15:51 +0000)] 
Add a test for header fields

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agospec: Recommend that relaying servers filter header fields
Simon McVittie [Mon, 11 Dec 2017 18:46:47 +0000 (18:46 +0000)] 
spec: Recommend that relaying servers filter header fields

This is an interpretation of the existing text. There are two plausible
ways a relaying server could interpret "must ignore [new] fields":
it could pass them through as-is, or it could delete them before
relaying. Until now, the reference implementation has done the former.

However, this behaviour is difficult to defend. If a server relays
messages without filtering out header fields that it doesn't
understand, then a client can't know whether the header field was
supplied by the server, or whether it was supplied by a (possibly
malicious) fellow client.

We can't introduce useful round-trip-reducing header fields like
SENDER_UNIX_USER_ID or SENDER_LINUX_SECURITY_LABEL until the
message bus filters them out, *and* provides a way for clients to
know for sure that it has done so. This is a step towards that
feature.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agospec: Allow non-message-bus servers to use SENDER and DESTINATION
Simon McVittie [Mon, 11 Dec 2017 18:40:36 +0000 (18:40 +0000)] 
spec: Allow non-message-bus servers to use SENDER and DESTINATION

The Telepathy "Tubes" APIs are an example of a server that is not a
message bus, but makes use of the sender and destination fields to
provide broadly unique-connection-name-like semantics.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoUpdate NEWS for #104224
Simon McVittie [Thu, 11 Jan 2018 18:28:17 +0000 (18:28 +0000)] 
Update NEWS for #104224

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agospec: Describe the EXTERNAL and ANONYMOUS auth mechanisms
Simon McVittie [Tue, 12 Dec 2017 13:36:24 +0000 (13:36 +0000)] 
spec: Describe the EXTERNAL and ANONYMOUS auth mechanisms

These are defined by standard RFCs rather than by D-Bus. What
separates them from other standard mechanisms like PLAIN (RFC 4616)
is that in practice, D-Bus implementations support EXTERNAL,
DBUS_COOKIE_SHA1 and sometimes ANONYMOUS, but not PLAIN.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104224

7 years agospec: Make example authentication transactions more realistic
Simon McVittie [Tue, 12 Dec 2017 13:19:51 +0000 (13:19 +0000)] 
spec: Make example authentication transactions more realistic

We don't need to invent a MAGIC_COOKIE mechanism when we have a
perfectly good EXTERNAL.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104224

7 years agospec: Define what non-empty authorization identity strings mean
Simon McVittie [Tue, 12 Dec 2017 13:10:11 +0000 (13:10 +0000)] 
spec: Define what non-empty authorization identity strings mean

The SASL RFC requires that we do this. I had previously thought that
the D-Bus protocol on Unix requires the use of numeric user IDs,
but in fact the reference implementation will also accept usernames.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104224

7 years agospec: ERROR takes an optional explanation in both directions
Simon McVittie [Mon, 11 Dec 2017 17:47:56 +0000 (17:47 +0000)] 
spec: ERROR takes an optional explanation in both directions

The examples don't include an explanation, but the reference
implementation always sends the human-readable explanation, in both
directions.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104224

7 years agospec: Document NEGOTIATE_UNIX_FD, AGREE_UNIX_FD in state machines
Simon McVittie [Mon, 11 Dec 2017 17:39:31 +0000 (17:39 +0000)] 
spec: Document NEGOTIATE_UNIX_FD, AGREE_UNIX_FD in state machines

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104224

7 years agospec: Document expected reply for each client-to-server auth command
Simon McVittie [Tue, 12 Dec 2017 12:33:00 +0000 (12:33 +0000)] 
spec: Document expected reply for each client-to-server auth command

Client-to-server auth commands expect a reply, whereas
server-to-client auth commands don't (the client is expected to send
another command that is valid in the new state, but it isn't really
a direct reply to the server-to-client command).

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104224

7 years agospec: Document the direction of each auth command
Simon McVittie [Tue, 12 Dec 2017 12:31:20 +0000 (12:31 +0000)] 
spec: Document the direction of each auth command

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104224

7 years agospec: Move text about the BEGIN command to documentation of BEGIN
Simon McVittie [Mon, 11 Dec 2017 17:27:16 +0000 (17:27 +0000)] 
spec: Move text about the BEGIN command to documentation of BEGIN

Having the text about the message stream in the documentation
of AUTH seemed rather odd, and made it likely to get out of sync
with the rest of the spec. Move it to the BEGIN section, remove
some duplication, and make it clearer that if the client pipelines
the fd-negotiation, the server is expected to send exactly one
reply per non-BEGIN command before switching to the D-Bus wire protocol.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104224

7 years agospec: Explicitly say that auth client and server take turns
Simon McVittie [Tue, 12 Dec 2017 12:23:50 +0000 (12:23 +0000)] 
spec: Explicitly say that auth client and server take turns

This was (hopefully) implicit in the protocol descriptions, but we
never actually said it. Do so.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104224

7 years agoRevert "spec: Document the initial Containers1 interface"
Simon McVittie [Thu, 11 Jan 2018 18:20:34 +0000 (18:20 +0000)] 
Revert "spec: Document the initial Containers1 interface"

This reverts commit 39262d0a2913fc8ee951beb3d0241720abf651c0.
I'm reasonably sure the API for Container1 is going to change
incompatibly, so it isn't ready to be in the published spec yet.

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoUpdate NEWS for #104577
Simon McVittie [Thu, 11 Jan 2018 12:39:13 +0000 (12:39 +0000)] 
Update NEWS for #104577

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoModify systemd tmpfiles.d snippet to create /var/lib/dbus/
Chris Lesiak [Wed, 10 Jan 2018 21:35:20 +0000 (15:35 -0600)] 
Modify systemd tmpfiles.d snippet to create /var/lib/dbus/

This snippet was already attempting to create /var/lib/dbus/machine-id,
but would fail on volatile or stateless systems where /var/lib/dbus/
did not already exist. systemd-tmpfiles automatically creates parent
directories for tmpfiles of type 'd', 'D', etc., but not for files
or symlinks (https://github.com/systemd/systemd/issues/7853).

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
[smcv: Extended commit message to clarify why we need this]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104577
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoUpdate NEWS
Simon McVittie [Sun, 24 Dec 2017 18:30:01 +0000 (18:30 +0000)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agospec: Deprecate hyphen/minus in well-known names
Simon McVittie [Sun, 26 Nov 2017 11:40:51 +0000 (11:40 +0000)] 
spec: Deprecate hyphen/minus in well-known names

We don't really need two parallel forms of punctuation, and in
particular DNS domain names only have one (hyphens). If we choose one
representation and deprecate the other, it makes the recommendation
clearer for app authors.

This reflects a similar change to the Desktop Entry Specification,
which uses D-Bus well-known names as app IDs. While hyphens are not a
problem for D-Bus well-known names or for freedesktop.org app IDs,
they create problems for adjacent APIs and specifications that want to
use a well-known name in a context where hyphens are not allowed.
Hyphens are not allowed in D-Bus object paths and interface names,
are only conditionally allowed in Flatpak app IDs (they can only
appear in the last element), and have a special syntactic role in
Freedesktop icon names.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103216
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103914
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: Alexander Larsson <alexl@redhat.com>
7 years agoUpdate NEWS for #104265
Simon McVittie [Thu, 14 Dec 2017 15:52:24 +0000 (15:52 +0000)] 
Update NEWS for #104265

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agoResolve bindir variable in dbus-1.pc file correctly
Benedikt Heine [Thu, 14 Dec 2017 14:28:10 +0000 (15:28 +0100)] 
Resolve bindir variable in dbus-1.pc file correctly

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104265
Reviewed-by: Simon McVittie <smcv@collabora.com>
7 years agoMerge branch 'containers-minimum-101354'
Simon McVittie [Tue, 12 Dec 2017 17:41:19 +0000 (17:41 +0000)] 
Merge branch 'containers-minimum-101354'

Add experimental support for creating extra servers at runtime, to
be used by app containers like Flatpak or Snap. This API is still
subject to change and is not compiled in by default.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354

7 years agoUpdate NEWS
Simon McVittie [Tue, 12 Dec 2017 17:41:01 +0000 (17:41 +0000)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
7 years agosystem.conf: Allow creating containers on the system bus
Simon McVittie [Fri, 30 Jun 2017 14:50:56 +0000 (15:50 +0100)] 
system.conf: Allow creating containers on the system bus

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

7 years agobus/driver: Allow unprivileged connections to create app-containers
Simon McVittie [Fri, 23 Jun 2017 15:45:13 +0000 (16:45 +0100)] 
bus/driver: Allow unprivileged connections to create app-containers

This lets ordinary users create a limited number of app-containers
on the system bus.

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

7 years agoRevert "test/uid-permissions: Assert that AddServer is privileged"
Simon McVittie [Mon, 24 Jul 2017 11:37:12 +0000 (12:37 +0100)] 
Revert "test/uid-permissions: Assert that AddServer is privileged"

I'm about to make that not be true.

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

7 years agotest/containers: Exercise the resource limits
Simon McVittie [Fri, 23 Jun 2017 15:24:22 +0000 (16:24 +0100)] 
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

7 years agocontainers: Enforce max_containers_per_user
Simon McVittie [Mon, 24 Jul 2017 11:36:32 +0000 (12:36 +0100)] 
containers: Enforce max_containers_per_user

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

7 years agobus/containers: Enforce max_connections_per_container
Simon McVittie [Thu, 22 Jun 2017 11:50:48 +0000 (12:50 +0100)] 
bus/containers: Enforce max_connections_per_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

7 years agobus/containers: Enforce max_containers limit
Simon McVittie [Thu, 22 Jun 2017 21:49:06 +0000 (22:49 +0100)] 
bus/containers: Enforce max_containers limit

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

7 years agobus/containers: Limit the size of metadata we will store
Simon McVittie [Thu, 22 Jun 2017 11:19:51 +0000 (12:19 +0100)] 
bus/containers: Limit the size of metadata we will store

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

7 years agobus: Add (unused) settings for resource limits for containers
Simon McVittie [Wed, 21 Jun 2017 15:35:34 +0000 (16:35 +0100)] 
bus: Add (unused) settings for resource limits for containers

These will be enforced in subsequent commits.

Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Fix whitespace]
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354

7 years agotest/containers: Check that GetInstanceInfo stops working
Simon McVittie [Fri, 23 Jun 2017 14:11:47 +0000 (15:11 +0100)] 
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

7 years agot/containers: Exercise trivial and non-trivial container metadata
Simon McVittie [Thu, 6 Jul 2017 16:29:26 +0000 (17:29 +0100)] 
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

7 years agobus/driver: Add GetConnectionInstance(), GetInstanceInfo()
Simon McVittie [Fri, 21 Jul 2017 17:08:40 +0000 (18:08 +0100)] 
bus/driver: Add GetConnectionInstance(), GetInstanceInfo()

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

7 years agotest/dbus-daemon: Assert absence of Containers1 credentials
Simon McVittie [Fri, 9 Jun 2017 14:59:44 +0000 (15:59 +0100)] 
test/dbus-daemon: Assert absence of Containers1 credentials

These connections are not to a container server.

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

7 years agobus/driver: Add basic container info to GetConnectionCredentials()
Simon McVittie [Fri, 9 Jun 2017 14:58:56 +0000 (15:58 +0100)] 
bus/driver: Add basic container info to GetConnectionCredentials()

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

7 years agobus/driver: Containers can't use the Verbose and Stats interfaces
Simon McVittie [Thu, 8 Jun 2017 17:17:31 +0000 (18:17 +0100)] 
bus/driver: Containers can't use the Verbose and Stats interfaces

These are debugging interfaces, which are essentially read-only.
By default, Verbose is not available on the system bus at all and
Stats is only available to uid 0, but both are available on the
session bus, and they can be allowed for other uids by configuring
the system bus.

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

7 years agobus/driver: Add a flag for methods that can't be invoked by containers
Simon McVittie [Fri, 9 Jun 2017 12:43:25 +0000 (13:43 +0100)] 
bus/driver: Add a flag for methods that can't be invoked by containers

We can relax AddServer() from PRIVILEGED to NOT_CONTAINERS when we've
put resource limits in place, although for now it must remain
PRIVILEGED because it uses up resources.

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

7 years agotest/containers: Check that connections from containers are unprivileged
Simon McVittie [Thu, 8 Jun 2017 13:43:43 +0000 (14:43 +0100)] 
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

7 years agotest/containers: Check that containers can't make new containers
Simon McVittie [Thu, 8 Jun 2017 13:44:05 +0000 (14:44 +0100)] 
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

7 years agobus/driver: Treat connections from inside containers as unprivileged
Simon McVittie [Thu, 8 Jun 2017 13:43:18 +0000 (14:43 +0100)] 
bus/driver: Treat connections from inside containers as unprivileged

Even if the uid matches, a contained app shouldn't count as the owner
of the bus.

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

7 years agobus/containers: Indicate in loginfo whether connection is contained
Simon McVittie [Fri, 21 Jul 2017 19:51:53 +0000 (20:51 +0100)] 
bus/containers: Indicate in loginfo whether connection is contained

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

7 years agotest/containers: Assert that InstanceRemoved is emitted
Simon McVittie [Fri, 23 Jun 2017 13:12:03 +0000 (14:12 +0100)] 
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

7 years agobus/containers: Emit InstanceRemoved signal
Simon McVittie [Fri, 23 Jun 2017 11:54:34 +0000 (12:54 +0100)] 
bus/containers: Emit InstanceRemoved signal

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

7 years agotest/containers: Exercise the various ways to stop a container
Simon McVittie [Tue, 20 Jun 2017 18:48:45 +0000 (19:48 +0100)] 
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

7 years agobus/containers: Don't allow stopping other users' containers
Simon McVittie [Fri, 23 Jun 2017 14:20:04 +0000 (15:20 +0100)] 
bus/containers: Don't allow stopping other users' containers

On the system bus, that would be a denial of service, assuming we
relax the access-control from METHOD_FLAG_PRIVILEGED to a new
METHOD_FLAG_NOT_CONTAINERS later.

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

7 years agobus/containers: Implement methods to stop containers explicitly
Simon McVittie [Thu, 22 Jun 2017 21:18:34 +0000 (22:18 +0100)] 
bus/containers: Implement methods to stop containers explicitly

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

7 years agobus/containers: Give each instance a list of all its connections
Simon McVittie [Mon, 6 Nov 2017 16:25:42 +0000 (16:25 +0000)] 
bus/containers: Give each instance a list of all its connections

Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Fix minor conflict]
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354

7 years agobus/containers: Shut down container servers when initiator goes away
Simon McVittie [Thu, 22 Jun 2017 17:47:03 +0000 (18:47 +0100)] 
bus/containers: Shut down container servers when initiator goes away

We will eventually want to have other ways to signal that a
container server should stop listening, so that the container manager
doesn't have to stay on D-Bus (fd-passing the read end of a pipe
whose write end will be closed by the container manager has been
suggested as easier to deal with for Flatpak/Bubblewrap), but for
now we're doing the simplest possible thing.

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

7 years agobus/containers: Link each container to its initiating connection
Simon McVittie [Mon, 6 Nov 2017 16:25:01 +0000 (16:25 +0000)] 
bus/containers: Link each container to its initiating connection

We will need this to be able to shut down the container when its
creator vanishes.

Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Fix minor conflict]
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354

7 years agobus/containers: Each connection to a container holds a reference
Simon McVittie [Mon, 6 Nov 2017 16:24:03 +0000 (16:24 +0000)] 
bus/containers: Each connection to a container holds a reference

Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Fix minor conflicts]
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354

7 years agotest/containers: Exercise connecting to the new socket as the wrong uid
Simon McVittie [Thu, 6 Jul 2017 15:37:50 +0000 (16:37 +0100)] 
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

7 years agobus/containers: Require connecting uid to match caller of AddServer
Simon McVittie [Thu, 22 Jun 2017 17:02:00 +0000 (18:02 +0100)] 
bus/containers: Require connecting uid to match caller of AddServer

If we're strict now, we can relax this later (either with a named
parameter or always); but if we're lenient now, we'll be stuck with it
forever, so be strict.

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

7 years agotest/containers: Exercise a successful call to AddServer
Simon McVittie [Tue, 20 Jun 2017 14:55:53 +0000 (15:55 +0100)] 
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

7 years agobus/containers: Set up new connections to join the bus
Simon McVittie [Thu, 22 Jun 2017 16:58:42 +0000 (17:58 +0100)] 
bus/containers: Set up new connections to join the bus

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

7 years agobus_context_add_incoming_connection: factor out
Simon McVittie [Mon, 6 Nov 2017 16:28:11 +0000 (16:28 +0000)] 
bus_context_add_incoming_connection: factor out

Reviewed-by: Philip Withnall <withnall@endlessm.com>
[smcv: Fix minor conflict]
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354

7 years agobus/containers: Create a DBusServer and add it to the main loop
Simon McVittie [Fri, 21 Jul 2017 19:09:15 +0000 (20:09 +0100)] 
bus/containers: Create a DBusServer and add it to the main loop

This means we can accept connections on the new socket. For now, we
don't process them and they get closed.

For the system bus (or root's session bus, where the difference is
harmless but makes automated testing easier), rely on system-wide
infrastructure to create /run/dbus/containers. The upstream dbus
distribution no longer contains integration glue for non-systemd boot
systems, but downstreams that maintain a non-systemd boot system and are
interested in the Containers interface should create /run/dbus/containers
during boot.

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

7 years agobus/containers: Build a global data structure for container instances
Simon McVittie [Tue, 20 Jun 2017 11:31:18 +0000 (12:31 +0100)] 
bus/containers: Build a global data structure for container instances

We still don't actually create a DBusServer for incoming connections
at this point, much less accept incoming connections.

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

7 years agotest/containers: Exercise the new parameter checking
Simon McVittie [Fri, 2 Jun 2017 18:35:56 +0000 (19:35 +0100)] 
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

7 years agobus/containers: Do some basic checking on the parameters
Simon McVittie [Fri, 2 Jun 2017 18:32:24 +0000 (19:32 +0100)] 
bus/containers: Do some basic checking on the parameters

In particular, we now fail early if we can't extract the file
descriptor, or if there are named parameters (none are supported yet).

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

7 years agotest/containers: New test
Simon McVittie [Tue, 20 Jun 2017 16:37:33 +0000 (17:37 +0100)] 
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

7 years agotest/uid-permissions: Assert that AddServer is privileged
Simon McVittie [Tue, 20 Jun 2017 16:36:59 +0000 (17:36 +0100)] 
test/uid-permissions: Assert that AddServer is privileged

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

7 years agotravis-ci: Do at least one build with and one without containers
Simon McVittie [Tue, 25 Jul 2017 11:43:40 +0000 (12:43 +0100)] 
travis-ci: Do at least one build with and one without containers

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

7 years agodriver: Add a stub implementation of the Containers1 interface
Simon McVittie [Fri, 2 Jun 2017 13:51:54 +0000 (14:51 +0100)] 
driver: Add a stub implementation of the Containers1 interface

For now, this is considered to be a privileged operation, because the
resource-limiting isn't wired up yet. It only contains the bare minimum
of API.

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

7 years agospec: Document the initial Containers1 interface
Simon McVittie [Fri, 2 Jun 2017 13:52:03 +0000 (14:52 +0100)] 
spec: Document the initial Containers1 interface

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

8 years ago_dbus_test_oom_handling: print TAP diagnostics
Simon McVittie [Tue, 28 Nov 2017 13:29:58 +0000 (13:29 +0000)] 
_dbus_test_oom_handling: print TAP diagnostics

These aren't *that* verbose, so it seems OK to print them all the time,
not just in the needlessly spammy verbose mode.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
8 years agotests: Add the ability to multiply up test timeouts
Simon McVittie [Mon, 27 Nov 2017 19:14:23 +0000 (19:14 +0000)] 
tests: Add the ability to multiply up test timeouts

Tests that brute-force OOM code paths can be rather slow.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
8 years agotest-utils: Separate failable and non-failable functions
Simon McVittie [Mon, 27 Nov 2017 19:26:03 +0000 (19:26 +0000)] 
test-utils: Separate failable and non-failable functions

test_object_try_whatever() now has libdbus-like OOM handling,
while test_object_whatever() has GLib-like OOM handling. This is
because an overwhelming majority of the callers of these functions
either didn't check for OOM anyway, or checked for it but then
aborted. In the uncommon case where we do care, we can use the _try_
version.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
8 years agotest_connection_setup: Don't crash on unlikely OOM
Simon McVittie [Mon, 27 Nov 2017 19:23:10 +0000 (19:23 +0000)] 
test_connection_setup: Don't crash on unlikely OOM

If _dbus_loop_queue_dispatch fails with OOM, we'd try to free cd,
while cd is already owned by the connection's timeout functions.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
8 years agotest_try_connect_to_bus: Cope with OOM while setting up connection
Simon McVittie [Mon, 27 Nov 2017 19:21:09 +0000 (19:21 +0000)] 
test_try_connect_to_bus: Cope with OOM while setting up connection

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>