diff options
author | Stef Walter <stef@memberwebs.com> | 2010-11-11 21:52:07 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2010-11-11 21:52:07 +0000 |
commit | d2ce4a0263db1d15cb89b7170aa671753be92b23 (patch) | |
tree | 607e95002cd706f135c4cdfa20578ee83cf7d2df /tool | |
parent | c29d40617d3ed7974019268e1aae5ad67e312b27 (diff) | |
parent | 5379f76cbbd057e6cf712c1b60e9b0b605f42a6d (diff) | |
download | gnome-keyring-d2ce4a0263db1d15cb89b7170aa671753be92b23.tar.gz |
Merge branch 'master' into trust-store
Diffstat (limited to 'tool')
-rw-r--r-- | tool/Makefile.am | 7 | ||||
-rw-r--r-- | tool/gkr-tool-import.c | 21 |
2 files changed, 21 insertions, 7 deletions
diff --git a/tool/Makefile.am b/tool/Makefile.am index 56c2cea3..441939ec 100644 --- a/tool/Makefile.am +++ b/tool/Makefile.am @@ -6,8 +6,9 @@ INCLUDES= \ -I$(top_builddir) \ $(GTK_CFLAGS) \ $(GOBJECT_CFLAGS) \ - $(GLIB_CFLAGS) - + $(GLIB_CFLAGS) \ + -DGCK_API_SUBJECT_TO_CHANGE + gnome_keyring@GCR_VERSION_SUFFIX@_SOURCES = \ gkr-tool.c gkr-tool.h \ gkr-tool-import.c \ @@ -18,9 +19,9 @@ gnome_keyring@GCR_VERSION_SUFFIX@_CFLAGS = \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" gnome_keyring@GCR_VERSION_SUFFIX@_LDADD = \ - $(top_builddir)/gck/libgck.la \ $(top_builddir)/gcr/libgcr@GCR_VERSION_SUFFIX@.la \ $(top_builddir)/egg/libegg.la \ + $(top_builddir)/gck/libgck.la \ $(GTHREAD_LIBS) \ $(GTK_LIBS) \ $(GCRYPT_LIBS) \ diff --git a/tool/gkr-tool-import.c b/tool/gkr-tool-import.c index 3c3f4888..97f37a41 100644 --- a/tool/gkr-tool-import.c +++ b/tool/gkr-tool-import.c @@ -42,15 +42,20 @@ static GOptionEntry import_entries[] = { static void on_imported (GcrImporter *importer, GckObject *object) { + gulong attr_types[3]; GckAttributes *attrs; GckAttribute *id; CK_OBJECT_CLASS klass; const gchar *message; GError *err = NULL; gchar *label, *hex; - - attrs = gck_attributes_new_empty (CKA_LABEL, CKA_CLASS, CKA_ID, GCK_INVALID); - if (!gck_object_get_full (object, attrs, NULL, &err)) { + + attr_types[0] = CKA_LABEL; + attr_types[1] = CKA_CLASS; + attr_types[2] = CKA_ID; + + attrs = gck_object_get_full (object, attr_types, G_N_ELEMENTS (attr_types), NULL, &err); + if (attrs == NULL) { gkr_tool_handle_error (&err, "couldn't get imported object info"); return; } @@ -98,6 +103,7 @@ int gkr_tool_import (int argc, char *argv[]) { GcrImporter *importer; + GcrParser *parser; GError *error = NULL; GInputStream *input; gboolean res; @@ -129,8 +135,15 @@ gkr_tool_import (int argc, char *argv[]) gkr_tool_handle_error (&error, "couldn't read file: %s", *imp); ret = 1; } else { - res = gcr_importer_import (importer, input, NULL, &error); + parser = gcr_parser_new (); + gcr_importer_listen (importer, parser); + res = gcr_parser_parse_stream (parser, input, NULL, &error); g_object_unref (input); + g_object_unref (parser); + + if (res == TRUE) + res = gcr_importer_import (importer, NULL, &error); + if (res == FALSE) { if (!error || error->code != GCR_ERROR_CANCELLED) gkr_tool_handle_error (&error, "couldn't import file: %s", *imp); |