• Iain Lane's avatar
    gkm-mock: Also store objects in the order they are taken · 7aba0e6a
    Iain Lane authored
    With GLib 2.59, the `test-login-auto` test fails:
      Gcr-CRITICAL **: 14:34:24.126: expected prompt property 'choice-label'
      to be "Automatically unlock this keyring whenever I\342\200\231m
      logged in", but it is instead ""
    This is because, in `mock_secret_C_Initialize()` we assign two sets of
    fields to the mock module, one with `CKA_G_LOGIN_COLLECTION` → `CK_TRUE`
    and one with it pointing to `CK_FALSE`.
    This variable is used to decide, via `is_login_keyring()`, whether to call
    `setup_unlock_keyring_login()` or `setup_unlock_keyring_other()`. The
    first one sets `choice-label` to the empty string. The second one is
    what we want, and upgrading GLib made it flip.
    The reason is the same as the previous two fixes: the mock-secret-store
    expects to be able to insert items into a hash table and then iterate it
    and get them out in the same order. That was never guaranteed, and now
    doesn't happen.
    Let's keep a parallel list which keeps track of the order things were
    added. And then instead of iterating the hash table, we iterate this
    Closes #21
gkm-mock.c 45.9 KB