sd-bus: skip sending formatted UIDs via SASL
authorDavid Rheinsberg <david.rheinsberg@gmail.com>
Thu, 14 Mar 2019 12:34:13 +0000 (13:34 +0100)
committerDavid Rheinsberg <david.rheinsberg@gmail.com>
Thu, 14 Mar 2019 12:34:13 +0000 (13:34 +0100)
commit1ed4723d38cd0d1423c8fe650f90fa86007ddf55
tree65e1204e5c84cfc599b3ca930ddb9fc6f8a94930
parent2010873b4b49b223e0cc07d28205b09c693ef005
sd-bus: skip sending formatted UIDs via SASL

The dbus external authentication takes as optional argument the UID the
sender wants to authenticate as. This uid is purely optional. The
AF_UNIX socket already conveys the same information through the
auxiliary socket data, so we really don't have to provide that
information.

Unfortunately, there is no way to send empty arguments, since they are
interpreted as "missing argument", which has a different meaning. The
SASL negotiation thus changes from:

    AUTH EXTERNAL <uid>
    NEGOTIATE_UNIX_FD                   (optional)
    BEGIN

to:

    AUTH EXTERNAL
    DATA
    NEGOTIATE_UNIX_FD                   (optional)
    BEGIN

And thus the replies we expect as a client change from:

    OK <server-id>
    AGREE_UNIX_FD                       (optional)

to:

    DATA
    OK <server-id>
    AGREE_UNIX_FD                       (optional)

Since the old sd-bus server implementation used the wrong reply for
"AUTH" requests that do not carry the arguments inlined, we decided to
make sd-bus clients accept this as well. Hence, sd-bus now allows
"OK <server-id>\r\n" replies instead of "DATA\r\n" replies.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
src/libsystemd/sd-bus/bus-socket.c