Skip to content

consolidate saved-profile scans into one skip-on-error helper #546

Description

@cachebag

there are six places that call ListConnections and then GetSettings on each profile:

  • core/connection_settings.rs (find_saved_connection_by_name)
  • core/connection.rs:428
  • core/vpn.rs:462, :755, :820, :910

all of them need to skip profiles that fail GetSettings (Settings.PermissionDenied for profiles restricted to other users via connection.permissions). five did, one didn't, and that one was the cause of pop-os/cosmic-settings#2184 (#545).

the skip-on-error behaviour should live in one helper in util/utils.rs (e.g. for_each_readable_profile) that hands each call site the parsed settings map, so a seventh scan can't reintroduce the bug by hand-rolling the loop.

no behaviour change; refactor only. a unit test isn't practical here since there's no d-bus mock and the integration harness runs as root, which bypasses profile acls.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dbusD-Bus types, signatures, or NM D-Bus APIrefactorChange or improve code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions