summaryrefslogtreecommitdiff
path: root/src/authorization/anastasis_authorization_plugin_iban.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/authorization/anastasis_authorization_plugin_iban.c')
-rw-r--r--src/authorization/anastasis_authorization_plugin_iban.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/src/authorization/anastasis_authorization_plugin_iban.c b/src/authorization/anastasis_authorization_plugin_iban.c
index d1a71f9..548b5c0 100644
--- a/src/authorization/anastasis_authorization_plugin_iban.c
+++ b/src/authorization/anastasis_authorization_plugin_iban.c
@@ -57,9 +57,9 @@ struct IBAN_Context
char *business_name;
/**
- * Database handle.
+ * Handle to interact with a authorization backend.
*/
- struct ANASTASIS_DatabasePlugin *db;
+ const struct ANASTASIS_AuthorizationContext *ac;
/**
* Amount we expect to be transferred.
@@ -407,14 +407,14 @@ iban_process (struct ANASTASIS_AUTHORIZATION_State *as,
GNUNET_CRYPTO_hash (as->iban_number,
strlen (as->iban_number),
&espec.debit_iban_hash);
- as->eh = ctx->db->event_listen (ctx->db->cls,
- &espec.header,
- &bank_event_cb,
- as);
+ as->eh = ctx->ac->db->event_listen (ctx->ac->db->cls,
+ &espec.header,
+ &bank_event_cb,
+ as);
}
- qs = ctx->db->test_challenge_code_satisfied (ctx->db->cls,
- &as->truth_uuid,
- as->code);
+ qs = ctx->ac->db->test_challenge_code_satisfied (ctx->ac->db->cls,
+ &as->truth_uuid,
+ as->code);
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
@@ -458,7 +458,7 @@ iban_cleanup (struct ANASTASIS_AUTHORIZATION_State *as)
if (NULL != as->eh)
{
- ctx->db->event_listen_cancel (as->eh);
+ ctx->ac->db->event_listen_cancel (as->eh);
as->eh = NULL;
}
GNUNET_free (as->iban_number);
@@ -469,14 +469,15 @@ iban_cleanup (struct ANASTASIS_AUTHORIZATION_State *as)
/**
* Initialize email based authorization plugin
*
- * @param cls a configuration instance
+ * @param cls a `struct ANASTASIS_AuthorizationContext`
* @return NULL on error, otherwise a `struct ANASTASIS_AuthorizationPlugin`
*/
void *
libanastasis_plugin_authorization_iban_init (void *cls)
{
+ struct ANASTASIS_AuthorizationContext *ac = cls;
struct ANASTASIS_AuthorizationPlugin *plugin;
- struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+ const struct GNUNET_CONFIGURATION_Handle *cfg = ac->cfg;
struct IBAN_Context *ctx;
ctx = GNUNET_new (struct IBAN_Context);
@@ -531,21 +532,12 @@ libanastasis_plugin_authorization_iban_init (void *cls)
}
GNUNET_free (fn);
}
- ctx->db = ANASTASIS_DB_plugin_load (cfg);
- if (NULL == ctx->db)
- {
- json_decref (ctx->messages);
- GNUNET_free (ctx->business_iban);
- GNUNET_free (ctx->business_name);
- GNUNET_free (ctx);
- return NULL;
- }
+ ctx->ac = ac;
if (GNUNET_OK !=
TALER_BANK_auth_parse_cfg (cfg,
"authorization-iban",
&ctx->auth))
{
- ANASTASIS_DB_plugin_unload (ctx->db);
json_decref (ctx->messages);
GNUNET_free (ctx->business_iban);
GNUNET_free (ctx->business_name);
@@ -579,7 +571,6 @@ libanastasis_plugin_authorization_iban_done (void *cls)
struct ANASTASIS_AuthorizationPlugin *plugin = cls;
struct IBAN_Context *ctx = plugin->cls;
- ANASTASIS_DB_plugin_unload (ctx->db);
TALER_BANK_auth_free (&ctx->auth);
json_decref (ctx->messages);
GNUNET_free (ctx->business_iban);