summaryrefslogtreecommitdiffstats
path: root/gtk/smartcard-manager.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2011-06-22 21:53:48 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2011-06-23 20:05:33 +0200
commit53e7d3086129bc269a2439e3d0d291351f154d6b (patch)
treea418770aa7d535eb672556b7cf3620b8de7a3a75 /gtk/smartcard-manager.c
parent8fab1c0c2185588545800c65db639594459093fb (diff)
downloadspice-gtk-53e7d3086129bc269a2439e3d0d291351f154d6b.tar.gz
spice-gtk-53e7d3086129bc269a2439e3d0d291351f154d6b.tar.xz
spice-gtk-53e7d3086129bc269a2439e3d0d291351f154d6b.zip
gtk/smartcard: simplify a little spice_smartcard_manager_init_libcacard
Diffstat (limited to 'gtk/smartcard-manager.c')
-rw-r--r--gtk/smartcard-manager.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/gtk/smartcard-manager.c b/gtk/smartcard-manager.c
index 5c5da8e..ad04722 100644
--- a/gtk/smartcard-manager.c
+++ b/gtk/smartcard-manager.c
@@ -369,18 +369,20 @@ gboolean spice_smartcard_reader_is_software(VReader *reader)
gboolean spice_smartcard_manager_init_libcacard(SpiceSession *session)
{
- char *emul_args;
+ gchar *emul_args = NULL;
VCardEmulOptions *options = NULL;
- char *dbname;
+ gchar *dbname = NULL;
GStrv certificates;
+ gboolean retval = FALSE;
g_return_val_if_fail(session != NULL, VCARD_EMUL_FAIL);
- g_object_get(G_OBJECT(session), "certificate-db", &dbname,
+ g_object_get(G_OBJECT(session),
+ "certificate-db", &dbname,
"certificates", &certificates,
NULL);
if ((certificates == NULL) || (g_strv_length(certificates) != 3))
- goto no_certs;
+ goto init;
if (dbname) {
emul_args = g_strdup_printf("db=\"%s\" use_hw=no "
@@ -394,18 +396,21 @@ gboolean spice_smartcard_manager_init_libcacard(SpiceSession *session)
certificates[0], certificates[1],
certificates[2]);
}
+
options = vcard_emul_options(emul_args);
- g_free(emul_args);
if (options == NULL) {
- g_free(dbname);
- g_strfreev(certificates);
- return FALSE;
+ g_critical("vcard_emul_options() failed!");
+ goto end;
}
-no_certs:
+init:
+ retval = vcard_emul_init(options) == VCARD_EMUL_OK;
+
+end:
+ g_free(emul_args);
g_free(dbname);
g_strfreev(certificates);
- return (vcard_emul_init(options) == VCARD_EMUL_OK);
+ return retval;
}
gboolean spice_smartcard_manager_insert_card(SpiceSmartCardManager *manager)