sd-bus: fix SASL reply to empty AUTH
authorDavid Rheinsberg <david.rheinsberg@gmail.com>
Thu, 14 Mar 2019 12:33:28 +0000 (13:33 +0100)
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>
Mon, 8 Jun 2020 14:01:18 +0000 (16:01 +0200)
commitbadb16c481cf592a1761ad20dd0a84614d2bbd5b
treec2f50bcc85176a2f694d21e0f674265a1de3a0e2
parentd524f9f9089b71d83e991ed42d25a4616ec575a2
sd-bus: fix SASL reply to empty AUTH

The correct way to reply to "AUTH <protocol>" without any payload is to
send "DATA" rather than "OK". The "DATA" reply triggers the client to
respond with the requested payload.

In fact, adding the data as hex-encoded argument like
"AUTH <protocol> <hex-data>" is an optimization that skips the "DATA"
roundtrip. The standard way to perform an authentication is to send the
"DATA" line.

This commit fixes sd-bus to properly send the "DATA" line. Surprisingly
no existing implementation depends on this, as they all pass the data
directly as argument to "AUTH". This will not work if we want to pass
an empty argument, though.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
(cherry picked from commit 2010873b4b49b223e0cc07d28205b09c693ef005)

Related: #1838081
src/libsystemd/sd-bus/bus-socket.c