diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-03 21:58:36 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-03 21:58:36 +0200 |
commit | ba3f70390a1e7210195c41e3afa3e7fe1511eb96 (patch) | |
tree | 8828877b90b208e0ccd85a9c013ef61829b3c33c /src/exchange | |
parent | 06676e72cb063c7abb264cbfd527f5c2d414dc7c (diff) | |
download | exchange-ba3f70390a1e7210195c41e3afa3e7fe1511eb96.tar.gz exchange-ba3f70390a1e7210195c41e3afa3e7fe1511eb96.tar.bz2 exchange-ba3f70390a1e7210195c41e3afa3e7fe1511eb96.zip |
restructure configuration, move bank account credentials from exchange-account-XXX to exchange-accountcredentials-XXX
Diffstat (limited to 'src/exchange')
-rw-r--r-- | src/exchange/taler-exchange-aggregator.c | 7 | ||||
-rw-r--r-- | src/exchange/taler-exchange-closer.c | 5 | ||||
-rw-r--r-- | src/exchange/taler-exchange-transfer.c | 10 | ||||
-rw-r--r-- | src/exchange/taler-exchange-wirewatch.c | 52 | ||||
-rw-r--r-- | src/exchange/test_taler_exchange_httpd.conf | 2 | ||||
-rw-r--r-- | src/exchange/test_taler_exchange_unix.conf | 2 |
6 files changed, 37 insertions, 41 deletions
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c index 75de467d9..a2ea65c37 100644 --- a/src/exchange/taler-exchange-aggregator.c +++ b/src/exchange/taler-exchange-aggregator.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2016-2020 Taler Systems SA + Copyright (C) 2016-2021 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software @@ -87,7 +87,7 @@ struct AggregationUnit * Exchange wire account to be used for the preparation and * eventual execution of the aggregate wire transfer. */ - struct TALER_EXCHANGEDB_WireAccount *wa; + const struct TALER_EXCHANGEDB_AccountInfo *wa; /** * Database session for all of our transactions. @@ -262,7 +262,8 @@ parse_wirewatch_config (void) return GNUNET_SYSERR; } if (GNUNET_OK != - TALER_EXCHANGEDB_load_accounts (cfg)) + TALER_EXCHANGEDB_load_accounts (cfg, + TALER_EXCHANGEDB_ALO_DEBIT)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No wire accounts configured for debit!\n"); diff --git a/src/exchange/taler-exchange-closer.c b/src/exchange/taler-exchange-closer.c index 0cd288b4b..d14bedaca 100644 --- a/src/exchange/taler-exchange-closer.c +++ b/src/exchange/taler-exchange-closer.c @@ -158,7 +158,8 @@ parse_wirewatch_config (void) return GNUNET_SYSERR; } if (GNUNET_OK != - TALER_EXCHANGEDB_load_accounts (cfg)) + TALER_EXCHANGEDB_load_accounts (cfg, + TALER_EXCHANGEDB_ALO_DEBIT)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No wire accounts configured for debit!\n"); @@ -236,7 +237,7 @@ expired_reserve_cb (void *cls, struct TALER_Amount closing_fee; int ret; enum GNUNET_DB_QueryStatus qs; - struct TALER_EXCHANGEDB_WireAccount *wa; + const struct TALER_EXCHANGEDB_AccountInfo *wa; /* NOTE: potential optimization: use custom SQL API to not fetch this: */ diff --git a/src/exchange/taler-exchange-transfer.c b/src/exchange/taler-exchange-transfer.c index a416eb15f..a242547b8 100644 --- a/src/exchange/taler-exchange-transfer.c +++ b/src/exchange/taler-exchange-transfer.c @@ -50,7 +50,7 @@ struct WirePrepareData /** * Wire account used for this preparation. */ - struct TALER_EXCHANGEDB_WireAccount *wa; + const struct TALER_EXCHANGEDB_AccountInfo *wa; /** * Row ID of the transfer. @@ -179,7 +179,9 @@ parse_wirewatch_config (void) return GNUNET_SYSERR; } if (GNUNET_OK != - TALER_EXCHANGEDB_load_accounts (cfg)) + TALER_EXCHANGEDB_load_accounts (cfg, + TALER_EXCHANGEDB_ALO_DEBIT + | TALER_EXCHANGEDB_ALO_AUTHDATA)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No wire accounts configured for debit!\n"); @@ -353,7 +355,7 @@ wire_prepare_cb (void *cls, const char *buf, size_t buf_size) { - struct TALER_EXCHANGEDB_WireAccount *wa; + const struct TALER_EXCHANGEDB_AccountInfo *wa; (void) cls; if ( (NULL == wire_method) || @@ -382,7 +384,7 @@ wire_prepare_cb (void *cls, } wa = wpd->wa; wpd->eh = TALER_BANK_transfer (ctx, - &wa->auth, + wa->auth, buf, buf_size, &wire_confirm_cb, diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c index eeb1af480..6e40fc001 100644 --- a/src/exchange/taler-exchange-wirewatch.c +++ b/src/exchange/taler-exchange-wirewatch.c @@ -52,9 +52,9 @@ struct WireAccount struct WireAccount *prev; /** - * Name of the section that configures this account. + * Information about this account. */ - char *section_name; + const struct TALER_EXCHANGEDB_AccountInfo *ai; /** * Database session we are using for the current transaction. @@ -67,11 +67,6 @@ struct WireAccount struct TALER_BANK_CreditHistoryHandle *hh; /** - * Authentication data. - */ - struct TALER_BANK_AuthenticationData auth; - - /** * Until when is processing this wire plugin delayed? */ struct GNUNET_TIME_Absolute delayed_until; @@ -233,8 +228,6 @@ shutdown_task (void *cls) GNUNET_CONTAINER_DLL_remove (wa_head, wa_tail, wa); - TALER_BANK_auth_free (&wa->auth); - GNUNET_free (wa->section_name); GNUNET_free (wa->job_name); GNUNET_free (wa); } @@ -258,6 +251,8 @@ shutdown_task (void *cls) } TALER_EXCHANGEDB_plugin_unload (db_plugin); db_plugin = NULL; + TALER_EXCHANGEDB_unload_accounts (); + cfg = NULL; } @@ -275,21 +270,10 @@ add_account_cb (void *cls, struct WireAccount *wa; (void) cls; - if (GNUNET_YES != ai->credit_enabled) + if (! ai->credit_enabled) return; /* not enabled for us, skip */ wa = GNUNET_new (struct WireAccount); - if (GNUNET_OK != - TALER_BANK_auth_parse_cfg (cfg, - ai->section_name, - &wa->auth)) - { - GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, - "Failed to load account `%s'\n", - ai->section_name); - GNUNET_free (wa); - return; - } - wa->section_name = GNUNET_strdup (ai->section_name); + wa->ai = ai; GNUNET_asprintf (&wa->job_name, "wirewatch-%s", ai->section_name); @@ -325,20 +309,24 @@ exchange_serve_process_config (void) if (NULL == (db_plugin = TALER_EXCHANGEDB_plugin_load (cfg))) { - fprintf (stderr, - "Failed to initialize DB subsystem\n"); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to initialize DB subsystem\n"); return GNUNET_SYSERR; } - TALER_EXCHANGEDB_find_accounts (cfg, - &add_account_cb, - NULL); - if (NULL == wa_head) + if (GNUNET_OK != + TALER_EXCHANGEDB_load_accounts (cfg, + TALER_EXCHANGEDB_ALO_CREDIT + | TALER_EXCHANGEDB_ALO_AUTHDATA)) { - fprintf (stderr, - "No wire accounts configured for credit!\n"); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "No wire accounts configured for credit!\n"); TALER_EXCHANGEDB_plugin_unload (db_plugin); + db_plugin = NULL; return GNUNET_SYSERR; } + TALER_EXCHANGEDB_find_accounts (&add_account_cb, + NULL); + GNUNET_assert (NULL != wa_head); return GNUNET_OK; } @@ -558,7 +546,7 @@ history_cb (void *cls, &details->amount, details->execution_date, details->debit_account_url, - wa->section_name, + wa->ai->section_name, serial_id); switch (qs) { @@ -683,7 +671,7 @@ find_transfers (void *cls) GNUNET_assert (NULL == wa_pos->hh); wa_pos->latest_row_off = wa_pos->batch_start; wa_pos->hh = TALER_BANK_credit_history (ctx, - &wa_pos->auth, + wa_pos->ai->auth, wa_pos->batch_start, limit, &history_cb, diff --git a/src/exchange/test_taler_exchange_httpd.conf b/src/exchange/test_taler_exchange_httpd.conf index 1c2372d8b..2adee5053 100644 --- a/src/exchange/test_taler_exchange_httpd.conf +++ b/src/exchange/test_taler_exchange_httpd.conf @@ -62,6 +62,8 @@ CONFIG = "postgres:///talercheck" PAYTO_URI = "payto://x-taler-bank/localhost:8082/3" ENABLE_DEBIT = YES ENABLE_CREDIT = YES + +[exchange-accountcredentials-1] WIRE_GATEWAY_AUTH_METHOD = basic USERNAME = Exchange PASSWORD = x diff --git a/src/exchange/test_taler_exchange_unix.conf b/src/exchange/test_taler_exchange_unix.conf index b795794d2..b9387f603 100644 --- a/src/exchange/test_taler_exchange_unix.conf +++ b/src/exchange/test_taler_exchange_unix.conf @@ -64,6 +64,8 @@ CONFIG = "postgres:///talercheck" PAYTO_URI = "payto://x-taler-bank/localhost:8082/3" ENABLE_DEBIT = YES ENABLE_CREDIT = YES + +[exchange-accountcredentials-1] TALER_BANK_AUTH_METHOD = NONE |