diff options
author | Stefan Walter <stefw@src.gnome.org> | 2008-12-30 02:18:02 +0000 |
---|---|---|
committer | Stefan Walter <stefw@src.gnome.org> | 2008-12-30 02:18:02 +0000 |
commit | e4bc09c74100a5d9165d35fa4db51c642d0091f7 (patch) | |
tree | 82ddf6e1963553b1cb9f2b0a86574a9b4dfd9ed4 /tool | |
parent | 64ed69dced12b3f6cabb143a195334711486bea1 (diff) | |
download | gnome-keyring-e4bc09c74100a5d9165d35fa4db51c642d0091f7.tar.gz |
Add support for specifying custom allocators on GP11Attributes, and fine
* gp11/gp11.h:
* gp11/gp11-attributes.c:
* gp11/gp11-object.c:
* gp11/gp11-private.h:
* gp11/gp11-session.c:
* gp11/tests/Makefile.am:
* gp11/tests/unit-test-gp11-attributes.c:
* gp11/tests/unit-test-gp11-crypto.c:
* gp11/tests/unit-test-gp11-object.c:
* tool/gkr-tool-import.c: Add support for specifying custom allocators
on GP11Attributes, and fine tune how gp11_object_get_* work. Add
concept of locked attribute arrays with guarantees of application to
not modify while we're processing them.
svn path=/trunk/; revision=1414
Diffstat (limited to 'tool')
-rw-r--r-- | tool/gkr-tool-import.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/tool/gkr-tool-import.c b/tool/gkr-tool-import.c index 1976767a..685b70a5 100644 --- a/tool/gkr-tool-import.c +++ b/tool/gkr-tool-import.c @@ -55,8 +55,8 @@ print_object_information (GP11Object *object) GError *err = NULL; gchar *label; - attrs = gp11_object_get_full (object, ATTR_TYPES, G_N_ELEMENTS(ATTR_TYPES), NULL, &err); - if(!attrs) { + attrs = gp11_attributes_new_empty (CKA_LABEL, CKA_CLASS, CKA_ID, -1); + if (!gp11_object_get_full (object, attrs, NULL, &err)) { gkr_tool_handle_error (&err, "couldn't get imported object info"); return; } @@ -115,18 +115,27 @@ print_object_information (GP11Object *object) static void print_import_information (GP11Session *session, GP11Object *import) { - GP11Attribute *attr; + CK_OBJECT_HANDLE_PTR handles; + CK_ULONG n_handles; + gsize length; GList *objects, *l; + GP11Slot *slot; GError *err; - attr = gp11_object_get_one (import, CKA_GNOME_IMPORT_OBJECTS, &err); - if (!attr) { + handles = gp11_object_get_data (import, CKA_GNOME_IMPORT_OBJECTS, &length, &err); + if (!handles) { gkr_tool_handle_error (&err, "couldn't find imported objects"); return; } + + n_handles = length / sizeof (CK_OBJECT_HANDLE); + + slot = gp11_session_get_slot (session); + g_return_if_fail (slot); - objects = gp11_objects_from_handle_array (session, attr); - gp11_attribute_free (attr); + objects = gp11_objects_from_handle_array (slot, handles, n_handles); + g_free (handles); + g_object_unref (slot); for (l = objects; l; l = g_list_next (l)) print_object_information (GP11_OBJECT (l->data)); |