diff options
author | Iain Lane <iainl@gnome.org> | 2019-01-30 14:34:51 +0000 |
---|---|---|
committer | Iain Lane <iainl@gnome.org> | 2019-01-30 16:44:09 +0000 |
commit | 7aba0e6aadd75fc688bf7f086a620e4dc41da6d0 (patch) | |
tree | 9f38e96d1fa47e60862527c0d5bea8a68107f5d9 /pkcs11/secret-store | |
parent | 3091bf66c07f8df66876ecc7832371170743b052 (diff) | |
download | gnome-keyring-7aba0e6aadd75fc688bf7f086a620e4dc41da6d0.tar.gz |
gkm-mock: Also store objects in the order they are taken
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
list.
Closes #21
Diffstat (limited to 'pkcs11/secret-store')
-rw-r--r-- | pkcs11/secret-store/gkm-secret-fields.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/pkcs11/secret-store/gkm-secret-fields.c b/pkcs11/secret-store/gkm-secret-fields.c index 95558c10..7e4559c6 100644 --- a/pkcs11/secret-store/gkm-secret-fields.c +++ b/pkcs11/secret-store/gkm-secret-fields.c @@ -244,8 +244,7 @@ gkm_secret_fields_serialize (CK_ATTRIBUTE_PTR attr, attr->ulValueLen += strlen (schema_name); attr->ulValueLen += 2; } - if (keys != NULL) - g_list_free (keys); + g_list_free (keys); return CKR_OK; } @@ -269,7 +268,6 @@ gkm_secret_fields_serialize (CK_ATTRIBUTE_PTR attr, rv = gkm_attribute_set_data (attr, result->str, result->len); g_string_free (result, TRUE); - if (keys != NULL) g_list_free (keys); return rv; |