Skip to content
  • Simon McVittie's avatar
    Fix confusion between "is it authenticated?" and "try to authenticate" · 36bb2125
    Simon McVittie authored and Ralf Habacker's avatar Ralf Habacker committed
    
    
    Historically, _dbus_transport_get_is_authenticated() has had the
    side-effect of trying to advance the authentication state machine (if
    there's enough buffered input to do so). This seems an inappropriate
    activity for what looks like a simple getter.
    
    Split it into _dbus_transport_try_to_authenticate (which does what it
    always used to do) and _dbus_transport_peek_is_authenticated (which
    is the simple getter version).
    
    To minimize the difference in behaviour for the stable branch of D-Bus,
    I've only used _dbus_transport_peek_is_authenticated where it was used
    in an assertion, which should clearly not have side effects (and I've
    checked that the asserting function cannot be called until both
    authentication and authorization have completed). Replacing most of the
    calls to get_is_authenticated with try_to_authenticate is a possible
    piece of future work.
    
    Based on patches from Cosimo Alfarano, who noticed this
    assertion-with-side-effects.
    
    Signed-off-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
    https://bugs.freedesktop.org/show_bug.cgi?id=39720
    
    
    Reviewed-by: default avatarCosimo Alfarano <cosimo.alfarano@collabora.com>
    36bb2125