Skip to content

Fix error behaviour on reload if a connection has an unknown uid

Simon McVittie requested to merge smcv/dbus:issue343 into master
  • userdb: Add proper error reporting when getting groups from a uid

    Previously, if dbus_connection_get_unix_user() succeeded but _dbus_unix_groups_from_uid() failed, then bus_connection_get_unix_groups() would incorrectly fail without setting the error indicator, resulting in "(null)" being logged, which is rather unhelpful.

    This also lets us distinguish between ENOMEM and other errors, such as the uid not existing in the system's user database.

    Fixes: 145fb99b (untitled refactoring commit, 2006-12-12)
    Helps: #343 (closed)

  • test: Add a targeted test for _dbus_unix_groups_from_uid()

    Helps: #343 (closed)

  • bus: When failing to reload client policy, continue iteration

    If we have a large number of connections to the bus, and we fail to reload the policy for one of them (perhaps because its uid no longer exists in the system user database), previously we would crash, which is obviously unintended. After the previous commit, we would stop iteration through the list of client connections, which doesn't seem great either: one bad connection shouldn't prevent us from reloading the rest of our state.

    Instead, let's distinguish between new connections (where we want failure to establish a security policy to be fatal), and pre-existing connections (where the current security policy is presumably good enough to keep using if we have nothing better). If we're unable to reload the policy for a pre-existing connection, log a warning and carry on iterating.

    Helps: #343 (closed)

/cc @pjb1008 @fvogt

Edited by Simon McVittie

Merge request reports