Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sdbus clients #54

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Support sdbus clients #54

wants to merge 3 commits into from

Commits on Jun 25, 2024

  1. Add support for pipelined SASL handshakes

    sd-bus sends the BEGIN command in at the same time as the AUTH command,
    assuming that the authentication will succeed. This ends up confusing
    xdg-dbus-proxy, as it assumes that BEGIN is not sent at the same time as
    any other messages. As a result, the server's authentication
    replies end up interpreted as standard D-Bus messages, failing parsing
    and resulting in the client being unable to connect.
    
    This changes the code to keep track of the number of authentication
    commands pipelined with BEGIN, then counts the responses from the server
    to know when the authentication phase of the connection has actually
    completed.
    
    Fixes flatpak#21 (finally!)
    
    Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
    refi64 authored and mardy committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    40caaad View commit details
    Browse the repository at this point in the history
  2. Complete auth only when all bus replies have been received

    This is a fixup for the previous commit.
    
    Signed-off-by: Alberto Mardegan <a.mardegan@omp.ru>
    mardy committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    78d86ae View commit details
    Browse the repository at this point in the history
  3. Don't forward client messages until authenticated

    Until the authentication is completed, hold off all client messages
    received after BEGIN. We only send to the server the authentication
    commands up (and including) the BEGIN command, but everything past the
    line terminators is queued into the `extra_input_data` buffer and we
    stop reading from the client socket.
    
    Once the authentication is completed, the (partial) message we saved
    into `extra_input_data` is queued for the D-Bus server into the first
    outgoing buffer, and reading from the client socket resumes.
    
    Note that in order to cleanly process the partial sendind of data,
    another offset is introduced into the Buffer structure, which holds the
    bytes of buffers which have already been sent over the socket.
    
    Signed-off-by: Alberto Mardegan <a.mardegan@omp.ru>
    mardy committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    48855d1 View commit details
    Browse the repository at this point in the history