diff --git a/ChangeLog b/ChangeLog index 0924d31e47..50a3da4fdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-01-13 Christian Stimming + + * src/import-export/hbci/hbci-interaction.c, gnc-hbci-utils.c: Add + workaround code for openhbci/chipcard problem. + 2004-01-12 Derek Atkins * src/app-utils/file-utils.[ch]: add gnc_getline() function diff --git a/src/import-export/hbci/gnc-hbci-utils.c b/src/import-export/hbci/gnc-hbci-utils.c index 86c17ac5f6..1624a95e14 100644 --- a/src/import-export/hbci/gnc-hbci-utils.c +++ b/src/import-export/hbci/gnc-hbci-utils.c @@ -425,6 +425,7 @@ gnc_hbci_api_execute (GtkWidget *parent, HBCI_API *api, return FALSE; } + GNCInteractor_set_cache_valid (inter, TRUE); if (resultcode <= 20) { HBCI_Error_delete (err); return TRUE; diff --git a/src/import-export/hbci/hbci-interaction.c b/src/import-export/hbci/hbci-interaction.c index 15bfc4f4f9..69d6ed97f1 100644 --- a/src/import-export/hbci/hbci-interaction.c +++ b/src/import-export/hbci/hbci-interaction.c @@ -52,6 +52,7 @@ GNCInteractor *gnc_hbci_api_interactors (HBCI_API *api, GtkWidget *parent) data = g_new0 (GNCInteractor, 1); data->parent = parent; data->keepAlive = TRUE; + data->cache_valid = FALSE; data->cache_pin = gnc_lookup_boolean_option(PREF_TAB_ONLINE_BANKING, "HBCI Remember PIN in memory", @@ -123,12 +124,19 @@ void GNCInteractor_delete(GNCInteractor *data) data->dialog = NULL; } +void GNCInteractor_set_cache_valid(GNCInteractor *i, gboolean value) +{ + g_assert(i); + i->cache_valid = value; +} + void GNCInteractor_erasePIN(GNCInteractor *i) { g_assert(i); if (i->pw != NULL) g_free (memset (i->pw, 0, strlen (i->pw))); i->pw = NULL; + i->cache_valid = FALSE; i->user = NULL; } void GNCInteractor_reparent (GNCInteractor *i, GtkWidget *new_parent) @@ -207,7 +215,7 @@ static int msgInputPin(const HBCI_User *user, g_free (msgstr); } else { - if (user && (user == data->user)) { + if (data->cache_valid && user && (user == data->user)) { /* Cached user matches, so use cached PIN. */ /*printf("Got the cached PIN for user %s.\n", HBCI_User_userId (user));*/ *pinbuf = g_strdup (data->pw); diff --git a/src/import-export/hbci/hbci-interaction.h b/src/import-export/hbci/hbci-interaction.h index b52a94cdec..fa04b9ff34 100644 --- a/src/import-export/hbci/hbci-interaction.h +++ b/src/import-export/hbci/hbci-interaction.h @@ -38,6 +38,7 @@ void GNCInteractor_hide(GNCInteractor *i); void GNCInteractor_delete(GNCInteractor *i); void GNCInteractor_erasePIN(GNCInteractor *i); void GNCInteractor_reparent (GNCInteractor *i, GtkWidget *new_parent); +void GNCInteractor_set_cache_valid(GNCInteractor *i, gboolean value); #endif diff --git a/src/import-export/hbci/hbci-interactionP.h b/src/import-export/hbci/hbci-interactionP.h index 14a2306f43..97ba65338e 100644 --- a/src/import-export/hbci/hbci-interactionP.h +++ b/src/import-export/hbci/hbci-interactionP.h @@ -77,6 +77,8 @@ struct _inter_data /* The cached PIN and the HBCI_User it's cached for. */ char *pw; const HBCI_User *user; + /* Whether this PIN is really valid or not. */ + gboolean cache_valid; }; void delete_GNCInteractor (GNCInteractor *data);