Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions dbus_next/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ class AuthExternal(Authenticator):

:sealso: https://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
"""
def __init__(self):
def __init__(self, uid=None):
self.negotiate_unix_fd = False
self.negotiating_fds = False

if uid is None:
uid = os.getuid()
self.hex_uid = str(uid).encode().hex()

def _authentication_start(self, negotiate_unix_fd=False) -> str:
self.negotiate_unix_fd = negotiate_unix_fd
hex_uid = str(os.getuid()).encode().hex()
return f'AUTH EXTERNAL {hex_uid}'
return f'AUTH EXTERNAL {self.hex_uid}'

def _receive_line(self, line: str):
response, args = _AuthResponse.parse(line)
Expand Down