From dc47f085a57a2185f8c14e05b914e8d2517baef4 Mon Sep 17 00:00:00 2001 From: Leif Middelschulte Date: Tue, 21 Jun 2022 17:03:50 +0200 Subject: [PATCH] AuthAnnonymous: add SASL compliance The dbus specification states that its authentication mechanism is a SASL profile. Unless (empty) data is provided with the mechanism right away (i.e. `AUTH ANONYMOUS `), SASL compliant authentication responds with a `DATA` message. While some dbus implementations do not do this, the sd-bus does as of systemd >=v242-rc1 [0]. This fixes the response in a backward compatible way by sending back an empty `DATA` message. [0] https://github.com/systemd/systemd/commit/2010873b4b49b223e0cc07d28205b09c693ef005 --- dbus_next/auth.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbus_next/auth.py b/dbus_next/auth.py index db91c86..3aa1574 100644 --- a/dbus_next/auth.py +++ b/dbus_next/auth.py @@ -94,6 +94,8 @@ def _authentication_start(self, negotiate_unix_fd=False) -> str: def _receive_line(self, line: str) -> str: response, args = _AuthResponse.parse(line) + if response == _AuthResponse.DATA: + return 'DATA' if response != _AuthResponse.OK: raise AuthError(f'authentication failed: {response.value}: {args}')