gio, client: don't send UIDs with EXTERNAL

Avoid setting the optional UID argument for the external
authentication.

It fixes using gdbus from a user namespace where geteuid() can be
different than the uid in the namespace where the server is running.

RFC 4422 allows us to send an empty authorization identity, which
means we want to authenticate as whatever identity the server can
derive from our out-of-band credentials. In particular, this is
helpful when doing IPC between different Linux user namespaces,
where client and server would disagree on what the client's Unix
uid is.
Because D-Bus does not have a way to represent an empty initial
response as distinct from the absence of an initial response, we
cannot use the initial-response optimization (RFC 4422 §4.3.a)
in this case, and must fall back to waiting for the server to
send a challenge.
However, note that not all server-side D-Bus implementations
implement this correctly, so it can harm interoperability.
The reference implementation (dbus, libdbus) and systemd's
implementation (sd-bus) are known to do this correctly,
but versions of GDBus older than 2.67.x did not.

Based on https://github.com/systemd/systemd/commit/1ed4723d38cd0d1423c8fe650f90fa86007ddf55

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
10 jobs for dbus-don-t-send-uid-namespaces in 12 minutes and 55 seconds (queued for 3 seconds)
latest