diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-12-01 09:19:58 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-12-01 09:19:58 +0100 |
commit | 06b8ed9ba8ed30181285b6c75089150d2662b366 (patch) | |
tree | a23cd37b036e90d1b85bf9c97d95f476342766ee /src | |
parent | 65915731a93a3057bb1844187b1aa3b476c4bd42 (diff) |
start with exchange management test
Diffstat (limited to 'src')
-rw-r--r-- | src/exchange-tools/Makefile.am | 3 | ||||
-rw-r--r-- | src/exchange-tools/exchange-offline.conf | 6 | ||||
-rw-r--r-- | src/include/taler_testing_lib.h | 30 | ||||
-rw-r--r-- | src/testing/.gitignore | 1 | ||||
-rw-r--r-- | src/testing/Makefile.am | 10 | ||||
-rw-r--r-- | src/testing/test_exchange_api.conf | 1 | ||||
-rw-r--r-- | src/testing/test_exchange_management_api.c | 121 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_auditor_add.c | 129 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_auditor_add_denom_sig.c | 165 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_auditor_del.c | 121 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_revoke_denom_key.c | 76 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_revoke_sign_key.c | 76 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_set_wire_fee.c | 90 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_wire_add.c | 94 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_wire_del.c | 78 | ||||
-rw-r--r-- | src/testing/testing_api_loop.c | 128 |
16 files changed, 415 insertions, 714 deletions
diff --git a/src/exchange-tools/Makefile.am b/src/exchange-tools/Makefile.am index a3689d81d..a7761a3d3 100644 --- a/src/exchange-tools/Makefile.am +++ b/src/exchange-tools/Makefile.am @@ -4,7 +4,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include pkgcfgdir = $(prefix)/share/taler/config.d/ pkgcfg_DATA = \ - coins.conf + coins.conf \ + exchange-offline.conf if USE_COVERAGE AM_CFLAGS = --coverage -O0 diff --git a/src/exchange-tools/exchange-offline.conf b/src/exchange-tools/exchange-offline.conf new file mode 100644 index 000000000..5490c1da0 --- /dev/null +++ b/src/exchange-tools/exchange-offline.conf @@ -0,0 +1,6 @@ +# This file is in the public domain. +# +[exchange-offline] + +# Where do we store the offline master private key of the exchange? +MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 3f028cadf..410a71b6a 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -417,6 +417,36 @@ struct TALER_TESTING_Interpreter struct GNUNET_OS_Process *exchanged; /** + * Public key of the auditor. + */ + struct TALER_AuditorPublicKeyP auditor_pub; + + /** + * Private key of the auditor. + */ + struct TALER_AuditorPrivateKeyP auditor_priv; + + /** + * Private offline signing key. + */ + struct TALER_MasterPrivateKeyP master_priv; + + /** + * Public offline signing key. + */ + struct TALER_MasterPublicKeyP master_pub; + + /** + * URL of the auditor (as per configuration). + */ + char *auditor_url; + + /** + * URL of the exchange (as per configuration). + */ + char *exchange_url; + + /** * #GNUNET_OK if key state should be reloaded. NOTE: this * field can be removed because a new "send signal" command * has been introduced. diff --git a/src/testing/.gitignore b/src/testing/.gitignore index 216c632e6..df5ddbfe8 100644 --- a/src/testing/.gitignore +++ b/src/testing/.gitignore @@ -7,3 +7,4 @@ test_taler_exchange_aggregator-postgres test_taler_exchange_wirewatch-postgres test_exchange_api_revocation report* +test_exchange_management_api diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index aecbacad9..0d50d95c6 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -134,6 +134,7 @@ check_PROGRAMS = \ test_exchange_api_keys_cherry_picking \ test_exchange_api_revocation \ test_exchange_api_overlapping_keys_bug \ + test_exchange_management_api \ test_taler_exchange_aggregator-postgres \ test_taler_exchange_wirewatch-postgres if HAVE_TWISTER @@ -216,6 +217,15 @@ test_exchange_api_LDADD = \ -ljansson \ $(XLIB) +test_exchange_management_api_SOURCES = \ + test_exchange_management_api.c +test_exchange_management_api_LDADD = \ + libtalertesting.la \ + $(top_builddir)/src/lib/libtalerexchange.la \ + $(top_builddir)/src/util/libtalerutil.la \ + -lgnunetutil \ + $(XLIB) + test_exchange_api_revocation_SOURCES = \ test_exchange_api_revocation.c test_exchange_api_revocation_LDADD = \ diff --git a/src/testing/test_exchange_api.conf b/src/testing/test_exchange_api.conf index 791a5adb9..e555907b1 100644 --- a/src/testing/test_exchange_api.conf +++ b/src/testing/test_exchange_api.conf @@ -17,7 +17,6 @@ BASE_URL = "http://localhost:8083/" # HTTP port the auditor listens to PORT = 8083 - [exchange] TERMS_ETAG = 0 diff --git a/src/testing/test_exchange_management_api.c b/src/testing/test_exchange_management_api.c new file mode 100644 index 000000000..821ac1978 --- /dev/null +++ b/src/testing/test_exchange_management_api.c @@ -0,0 +1,121 @@ +/* + This file is part of TALER + Copyright (C) 2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3, or + (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with TALER; see the file COPYING. If not, see + <http://www.gnu.org/licenses/> +*/ +/** + * @file testing/test_exchange_management_api.c + * @brief testcase to test exchange's HTTP /management/ API + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_util.h" +#include "taler_exchange_service.h" +#include <gnunet/gnunet_util_lib.h> +#include <microhttpd.h> +#include "taler_testing_lib.h" + +/** + * Configuration file we use. One (big) configuration is used + * for the various components for this test. + */ +#define CONFIG_FILE "test_exchange_api.conf" + + +/** + * Exchange configuration data. + */ +static struct TALER_TESTING_ExchangeConfiguration ec; + +/** + * Bank configuration data. + */ +static struct TALER_TESTING_BankConfiguration bc; + + +/** + * Main function that will tell the interpreter what commands to + * run. + * + * @param cls closure + * @param is interpreter we use to run commands + */ +static void +run (void *cls, + struct TALER_TESTING_Interpreter *is) +{ + struct TALER_TESTING_Command commands[] = { + TALER_TESTING_cmd_auditor_add ("add-auditor-OK", + MHD_HTTP_NO_CONTENT, + false), + TALER_TESTING_cmd_end () + }; + + TALER_TESTING_run_with_fakebank (is, + commands, + bc.exchange_auth.wire_gateway_url); +} + + +int +main (int argc, + char *const *argv) +{ + /* These environment variables get in the way... */ + unsetenv ("XDG_DATA_HOME"); + unsetenv ("XDG_CONFIG_HOME"); + GNUNET_log_setup ("test-exchange-management-api", + "INFO", + NULL); + /* Check fakebank port is available and get config */ + if (GNUNET_OK != + TALER_TESTING_prepare_fakebank (CONFIG_FILE, + "exchange-account-2", + &bc)) + return 77; + TALER_TESTING_cleanup_files (CONFIG_FILE); + /* @helpers. Run keyup, create tables, ... Note: it + * fetches the port number from config in order to see + * if it's available. */ + switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, + GNUNET_YES, + &ec)) + { + case GNUNET_SYSERR: + GNUNET_break (0); + return 1; + case GNUNET_NO: + return 77; + case GNUNET_OK: + if (GNUNET_OK != + /* Set up event loop and reschedule context, plus + * start/stop the exchange. It calls TALER_TESTING_setup + * which creates the 'is' object. + */ + TALER_TESTING_setup_with_exchange (&run, + NULL, + CONFIG_FILE)) + return 1; + break; + default: + GNUNET_break (0); + return 1; + } + return 0; +} + + +/* end of test_exchange_management_api.c */ diff --git a/src/testing/testing_api_cmd_auditor_add.c b/src/testing/testing_api_cmd_auditor_add.c index 64a848190..5acb5c1e0 100644 --- a/src/testing/testing_api_cmd_auditor_add.c +++ b/src/testing/testing_api_cmd_auditor_add.c @@ -102,28 +102,13 @@ auditor_add_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct AuditorAddState *ds = cls; - struct TALER_AuditorPublicKeyP auditor_pub; - char *auditor_url; - char *exchange_url; - struct TALER_MasterSignatureP master_sig; struct GNUNET_TIME_Absolute now; + struct TALER_MasterSignatureP master_sig; (void) cmd; now = GNUNET_TIME_absolute_get (); (void) GNUNET_TIME_round_abs (&now); ds->is = is; - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "auditor", - "BASE_URL", - &auditor_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "auditor", - "BASE_URL"); - TALER_TESTING_interpreter_next (ds->is); - return; - } if (ds->bad_sig) { memset (&master_sig, @@ -132,89 +117,6 @@ auditor_add_run (void *cls, } else { - char *fn; - struct TALER_MasterPrivateKeyP master_priv; - struct TALER_AuditorPrivateKeyP auditor_priv; - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "exchange-offline", - "MASTER_PRIV_FILE", - &fn)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange-offline", - "MASTER_PRIV_FILE"); - TALER_TESTING_interpreter_next (ds->is); - GNUNET_free (auditor_url); - return; - } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for master private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - GNUNET_free (auditor_url); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &master_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load master private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - GNUNET_free (auditor_url); - return; - } - GNUNET_free (fn); - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "auditor", - "AUDITOR_PRIV_FILE", - &fn)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "auditor", - "AUDITOR_PRIV_FILE"); - TALER_TESTING_interpreter_next (ds->is); - GNUNET_free (auditor_url); - return; - } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for auditor private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - GNUNET_free (auditor_url); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &auditor_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load auditor private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - GNUNET_free (auditor_url); - return; - } - GNUNET_free (fn); - GNUNET_CRYPTO_eddsa_key_get_public (&auditor_priv.eddsa_priv, - &auditor_pub.eddsa_pub); /* now sign */ { @@ -222,43 +124,28 @@ auditor_add_run (void *cls, .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_AUDITOR), .purpose.size = htonl (sizeof (kv)), .start_date = GNUNET_TIME_absolute_hton (now), - .auditor_pub = auditor_pub, + .auditor_pub = is->auditor_pub, }; - GNUNET_CRYPTO_hash (auditor_url, - strlen (auditor_url) + 1, + GNUNET_CRYPTO_hash (is->auditor_url, + strlen (is->auditor_url) + 1, &kv.h_auditor_url); /* Finally sign ... */ - GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, + GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, &kv, &master_sig.eddsa_signature); } } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (is->cfg, - "exchange", - "BASE_URL", - &exchange_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange", - "BASE_URL"); - GNUNET_free (auditor_url); - TALER_TESTING_interpreter_next (ds->is); - return; - } ds->dh = TALER_EXCHANGE_management_enable_auditor ( is->ctx, - exchange_url, - &auditor_pub, - auditor_url, + is->exchange_url, + &is->auditor_pub, + is->auditor_url, "test-case auditor", /* human-readable auditor name */ now, &master_sig, &auditor_add_cb, ds); - GNUNET_free (exchange_url); - GNUNET_free (auditor_url); if (NULL == ds->dh) { GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_auditor_add_denom_sig.c b/src/testing/testing_api_cmd_auditor_add_denom_sig.c index dc75221df..8d5aace40 100644 --- a/src/testing/testing_api_cmd_auditor_add_denom_sig.c +++ b/src/testing/testing_api_cmd_auditor_add_denom_sig.c @@ -107,12 +107,8 @@ auditor_add_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct AuditorAddDenomSigState *ds = cls; - char *exchange_url; - struct TALER_AuditorPrivateKeyP auditor_priv; - struct TALER_AuditorPublicKeyP auditor_pub; struct TALER_AuditorSignatureP auditor_sig; struct GNUNET_HashCode h_denom_pub; - char *fn; const struct TALER_EXCHANGE_DenomPublicKey *dk; (void) cmd; @@ -134,33 +130,6 @@ auditor_add_run (void *cls, 0, &dk)); } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for auditor private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &auditor_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load auditor private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - GNUNET_free (fn); - GNUNET_CRYPTO_eddsa_key_get_public (&auditor_priv.eddsa_priv, - &auditor_pub.eddsa_pub); - - ds->is = is; if (ds->bad_sig) { @@ -170,117 +139,45 @@ auditor_add_run (void *cls, } else { - struct TALER_MasterPrivateKeyP master_priv; - char *auditor_url; - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "exchange-offline", - "MASTER_PRIV_FILE", - &fn)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange-offline", - "MASTER_PRIV_FILE"); - TALER_TESTING_interpreter_next (ds->is); - GNUNET_free (auditor_url); - return; - } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for master private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &master_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load master private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - GNUNET_free (fn); - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "auditor", - "BASE_URL", - &auditor_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "auditor", - "BASE_URL"); - TALER_TESTING_interpreter_next (ds->is); - return; - } - - /* now sign */ - { - struct TALER_ExchangeKeyValidityPS kv = { - .purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS), - .purpose.size = htonl (sizeof (struct TALER_ExchangeKeyValidityPS)), - .start = GNUNET_TIME_absolute_hton (dk->valid_from), - .expire_withdraw = GNUNET_TIME_absolute_hton ( - dk->withdraw_valid_until), - .expire_deposit = GNUNET_TIME_absolute_hton (dk->expire_deposit), - .expire_legal = GNUNET_TIME_absolute_hton (dk->expire_legal), - .denom_hash = dk->h_key - }; - - TALER_amount_hton (&kv.value, - &dk->value); - TALER_amount_hton (&kv.fee_withdraw, - &dk->fee_withdraw); - TALER_amount_hton (&kv.fee_deposit, - &dk->fee_deposit); - TALER_amount_hton (&kv.fee_refresh, - &dk->fee_refresh); - TALER_amount_hton (&kv.fee_refund, - &dk->fee_refund); - GNUNET_CRYPTO_eddsa_key_get_public (&master_priv.eddsa_priv, - &kv.master.eddsa_pub); - GNUNET_CRYPTO_hash (auditor_url, - strlen (auditor_url) + 1, - &kv.auditor_url_hash); - /* Finally sign ... */ - GNUNET_CRYPTO_eddsa_sign (&auditor_priv.eddsa_priv, - &kv, - &auditor_sig.eddsa_sig); - } - GNUNET_free (auditor_url); - } - + struct TALER_ExchangeKeyValidityPS kv = { + .purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS), + .purpose.size = htonl (sizeof (struct TALER_ExchangeKeyValidityPS)), + .start = GNUNET_TIME_absolute_hton (dk->valid_from), + .expire_withdraw = GNUNET_TIME_absolute_hton ( + dk->withdraw_valid_until), + .expire_deposit = GNUNET_TIME_absolute_hton (dk->expire_deposit), + .expire_legal = GNUNET_TIME_absolute_hton (dk->expire_legal), + .denom_hash = dk->h_key + }; - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (is->cfg, - "exchange", - "BASE_URL", - &exchange_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange", - "BASE_URL"); - TALER_TESTING_interpreter_next (ds->is); - return; + TALER_amount_hton (&kv.value, + &dk->value); + TALER_amount_hton (&kv.fee_withdraw, + &dk->fee_withdraw); + TALER_amount_hton (&kv.fee_deposit, + &dk->fee_deposit); + TALER_amount_hton (&kv.fee_refresh, + &dk->fee_refresh); + TALER_amount_hton (&kv.fee_refund, + &dk->fee_refund); + GNUNET_CRYPTO_eddsa_key_get_public (&is->master_priv.eddsa_priv, + &kv.master.eddsa_pub); + GNUNET_CRYPTO_hash (is->auditor_url, + strlen (is->auditor_url) + 1, + &kv.auditor_url_hash); + /* Finally sign ... */ + GNUNET_CRYPTO_eddsa_sign (&is->auditor_priv.eddsa_priv, + &kv, + &auditor_sig.eddsa_sig); } ds->dh = TALER_EXCHANGE_add_auditor_denomination ( is->ctx, - exchange_url, + is->exchange_url, &h_denom_pub, - &auditor_pub, + &is->auditor_pub, &auditor_sig, &denom_sig_add_cb, ds); - GNUNET_free (exchange_url); if (NULL == ds->dh) { GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_auditor_del.c b/src/testing/testing_api_cmd_auditor_del.c index 11efbd404..fd75e8268 100644 --- a/src/testing/testing_api_cmd_auditor_del.c +++ b/src/testing/testing_api_cmd_auditor_del.c @@ -102,8 +102,6 @@ auditor_del_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct AuditorDelState *ds = cls; - struct TALER_AuditorPublicKeyP auditor_pub; - char *exchange_url; struct TALER_MasterSignatureP master_sig; struct GNUNET_TIME_Absolute now; @@ -119,121 +117,26 @@ auditor_del_run (void *cls, } else { - char *fn; - struct TALER_MasterPrivateKeyP master_priv; - struct TALER_AuditorPrivateKeyP auditor_priv; - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "exchange-offline", - "MASTER_PRIV_FILE", - &fn)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange-offline", - "MASTER_PRIV_FILE"); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for master private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &master_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load master private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - GNUNET_free (fn); - - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "auditor", - "AUDITOR_PRIV_FILE", - &fn)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "auditor", - "AUDITOR_PRIV_FILE"); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for auditor private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &auditor_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load auditor private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - GNUNET_free (fn); - GNUNET_CRYPTO_eddsa_key_get_public (&auditor_priv.eddsa_priv, - &auditor_pub.eddsa_pub); - - /* now sign */ - { - struct TALER_MasterDelAuditorPS kv = { - .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_AUDITOR), - .purpose.size = htonl (sizeof (kv)), - .end_date = GNUNET_TIME_absolute_hton (now), - .auditor_pub = auditor_pub, - }; + struct TALER_MasterDelAuditorPS kv = { + .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_AUDITOR), + .purpose.size = htonl (sizeof (kv)), + .end_date = GNUNET_TIME_absolute_hton (now), + .auditor_pub = is->auditor_pub, + }; - /* Finally sign ... */ - GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, - &kv, - &master_sig.eddsa_signature); - } - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (is->cfg, - "exchange", - "BASE_URL", - &exchange_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange", - "BASE_URL"); - TALER_TESTING_interpreter_next (ds->is); - return; + /* Finally sign ... */ + GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, + &kv, + &master_sig.eddsa_signature); } ds->dh = TALER_EXCHANGE_management_disable_auditor ( is->ctx, - exchange_url, - &auditor_pub, + is->exchange_url, + &is->auditor_pub, now, &master_sig, &auditor_del_cb, ds); - GNUNET_free (exchange_url); if (NULL == ds->dh) { GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_revoke_denom_key.c b/src/testing/testing_api_cmd_revoke_denom_key.c index 2e524338c..7dffcf395 100644 --- a/src/testing/testing_api_cmd_revoke_denom_key.c +++ b/src/testing/testing_api_cmd_revoke_denom_key.c @@ -159,7 +159,6 @@ revoke_run (void *cls, struct RevokeState *rs = cls; const struct TALER_TESTING_Command *coin_cmd; const struct TALER_EXCHANGE_DenomPublicKey *denom_pub; - char *exchange_url; struct TALER_MasterSignatureP master_sig; rs->is = is; @@ -188,79 +187,24 @@ revoke_run (void *cls, } else { - char *fn; - struct TALER_MasterPrivateKeyP master_priv; - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "exchange-offline", - "MASTER_PRIV_FILE", - &fn)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange-offline", - "MASTER_PRIV_FILE"); - TALER_TESTING_interpreter_next (rs->is); - return; - } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for master private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (rs->is); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &master_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load master private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (rs->is); - return; - } - GNUNET_free (fn); - - /* now sign */ - { - struct TALER_MasterDenominationKeyRevocationPS kv = { - .purpose.purpose = htonl ( - TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED), - .purpose.size = htonl (sizeof (kv)), - .h_denom_pub = denom_pub->h_key - }; + struct TALER_MasterDenominationKeyRevocationPS kv = { + .purpose.purpose = htonl ( + TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED), + .purpose.size = htonl (sizeof (kv)), + .h_denom_pub = denom_pub->h_key + }; - GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, - &kv, - &master_sig.eddsa_signature); - } - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (is->cfg, - "exchange", - "BASE_URL", - &exchange_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange", - "BASE_URL"); - TALER_TESTING_interpreter_next (rs->is); - return; + GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, + &kv, + &master_sig.eddsa_signature); } rs->kh = TALER_EXCHANGE_management_revoke_denomination_key ( is->ctx, - exchange_url, + is->exchange_url, &denom_pub->h_key, &master_sig, &success_cb, rs); - GNUNET_free (exchange_url); if (NULL == rs->kh) { GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_revoke_sign_key.c b/src/testing/testing_api_cmd_revoke_sign_key.c index 72f288d78..d85f63053 100644 --- a/src/testing/testing_api_cmd_revoke_sign_key.c +++ b/src/testing/testing_api_cmd_revoke_sign_key.c @@ -159,7 +159,6 @@ revoke_run (void *cls, struct RevokeState *rs = cls; const struct TALER_TESTING_Command *coin_cmd; const struct TALER_ExchangePublicKeyP *exchange_pub; - char *exchange_url; struct TALER_MasterSignatureP master_sig; rs->is = is; @@ -188,79 +187,24 @@ revoke_run (void *cls, } else { - char *fn; - struct TALER_MasterPrivateKeyP master_priv; - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "exchange-offline", - "MASTER_PRIV_FILE", - &fn)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange-offline", - "MASTER_PRIV_FILE"); - TALER_TESTING_interpreter_next (rs->is); - return; - } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for master private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (rs->is); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &master_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load master private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (rs->is); - return; - } - GNUNET_free (fn); - - /* now sign */ - { - struct TALER_MasterSigningKeyRevocationPS kv = { - .purpose.purpose = htonl ( - TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED), - .purpose.size = htonl (sizeof (kv)), - .exchange_pub = *exchange_pub - }; + struct TALER_MasterSigningKeyRevocationPS kv = { + .purpose.purpose = htonl ( + TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED), + .purpose.size = htonl (sizeof (kv)), + .exchange_pub = *exchange_pub + }; - GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, - &kv, - &master_sig.eddsa_signature); - } - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (is->cfg, - "exchange", - "BASE_URL", - &exchange_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange", - "BASE_URL"); - TALER_TESTING_interpreter_next (rs->is); - return; + GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, + &kv, + &master_sig.eddsa_signature); } rs->kh = TALER_EXCHANGE_management_revoke_signing_key ( is->ctx, - exchange_url, + is->exchange_url, exchange_pub, &master_sig, &success_cb, rs); - GNUNET_free (exchange_url); if (NULL == rs->kh) { GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_set_wire_fee.c b/src/testing/testing_api_cmd_set_wire_fee.c index f72768d0c..1f8b3994a 100644 --- a/src/testing/testing_api_cmd_set_wire_fee.c +++ b/src/testing/testing_api_cmd_set_wire_fee.c @@ -117,7 +117,6 @@ wire_add_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct WireFeeState *ds = cls; - char *exchange_url; struct TALER_MasterSignatureP master_sig; struct GNUNET_TIME_Absolute now; struct GNUNET_TIME_Absolute start_time; @@ -153,81 +152,27 @@ wire_add_run (void *cls, } else { - char *fn; - struct TALER_MasterPrivateKeyP master_priv; - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "exchange-offline", - "MASTER_PRIV_FILE", - &fn)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange-offline", - "MASTER_PRIV_FILE"); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for master private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &master_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load master private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - GNUNET_free (fn); - - /* now sign */ - { - struct TALER_MasterWireFeePS kv = { - .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES), - .purpose.size = htonl (sizeof (kv)), - .start_date = GNUNET_TIME_absolute_hton (start_time), - .end_date = GNUNET_TIME_absolute_hton (end_time), - }; + struct TALER_MasterWireFeePS kv = { + .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES), + .purpose.size = htonl (sizeof (kv)), + .start_date = GNUNET_TIME_absolute_hton (start_time), + .end_date = GNUNET_TIME_absolute_hton (end_time), + }; - GNUNET_CRYPTO_hash (ds->wire_method, - strlen (ds->wire_method) + 1, - &kv.h_wire_method); - TALER_amount_hton (&kv.wire_fee, - &wire_fee); - TALER_amount_hton (&kv.closing_fee, - &closing_fee); - GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, - &kv, - &master_sig.eddsa_signature); - } - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (is->cfg, - "exchange", - "BASE_URL", - &exchange_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange", - "BASE_URL"); - TALER_TESTING_interpreter_next (ds->is); - return; + GNUNET_CRYPTO_hash (ds->wire_method, + strlen (ds->wire_method) + 1, + &kv.h_wire_method); + TALER_amount_hton (&kv.wire_fee, + &wire_fee); + TALER_amount_hton (&kv.closing_fee, + &closing_fee); + GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, + &kv, + &master_sig.eddsa_signature); } ds->dh = TALER_EXCHANGE_management_set_wire_fees ( is->ctx, - exchange_url, + is->exchange_url, ds->wire_method, start_time, end_time, @@ -236,7 +181,6 @@ wire_add_run (void *cls, &master_sig, &wire_add_cb, ds); - GNUNET_free (exchange_url); if (NULL == ds->dh) { GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_wire_add.c b/src/testing/testing_api_cmd_wire_add.c index 0384e78a6..698e02399 100644 --- a/src/testing/testing_api_cmd_wire_add.c +++ b/src/testing/testing_api_cmd_wire_add.c @@ -107,7 +107,6 @@ wire_add_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct WireAddState *ds = cls; - char *exchange_url; struct TALER_MasterSignatureP master_sig1; struct TALER_MasterSignatureP master_sig2; struct GNUNET_TIME_Absolute now; @@ -127,90 +126,35 @@ wire_add_run (void *cls, } else { - char *fn; - struct TALER_MasterPrivateKeyP master_priv; - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "exchange-offline", - "MASTER_PRIV_FILE", - &fn)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange-offline", - "MASTER_PRIV_FILE"); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for master private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &master_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load master private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - GNUNET_free (fn); - - /* now sign */ - { - struct TALER_MasterAddWirePS kv = { - .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_WIRE), - .purpose.size = htonl (sizeof (kv)), - .start_date = GNUNET_TIME_absolute_hton (now), - }; - struct TALER_MasterWireDetailsPS wd = { - .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_DETAILS), - .purpose.size = htonl (sizeof (wd)), - }; + struct TALER_MasterAddWirePS kv = { + .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_WIRE), + .purpose.size = htonl (sizeof (kv)), + .start_date = GNUNET_TIME_absolute_hton (now), + }; + struct TALER_MasterWireDetailsPS wd = { + .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_DETAILS), + .purpose.size = htonl (sizeof (wd)), + }; - TALER_exchange_wire_signature_hash (ds->payto_uri, - &kv.h_wire); - wd.h_wire_details = kv.h_wire; - GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, - &kv, - &master_sig1.eddsa_signature); - GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, - &wd, - &master_sig2.eddsa_signature); - } - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (is->cfg, - "exchange", - "BASE_URL", - &exchange_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange", - "BASE_URL"); - TALER_TESTING_interpreter_next (ds->is); - return; + TALER_exchange_wire_signature_hash (ds->payto_uri, + &kv.h_wire); + wd.h_wire_details = kv.h_wire; + GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, + &kv, + &master_sig1.eddsa_signature); + GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, + &wd, + &master_sig2.eddsa_signature); } ds->dh = TALER_EXCHANGE_management_enable_wire ( is->ctx, - exchange_url, + is->exchange_url, ds->payto_uri, now, &master_sig1, &master_sig2, &wire_add_cb, ds); - GNUNET_free (exchange_url); if (NULL == ds->dh) { GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_wire_del.c b/src/testing/testing_api_cmd_wire_del.c index 06de499ad..2019d1366 100644 --- a/src/testing/testing_api_cmd_wire_del.c +++ b/src/testing/testing_api_cmd_wire_del.c @@ -107,7 +107,6 @@ wire_del_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct WireDelState *ds = cls; - char *exchange_url; struct TALER_MasterSignatureP master_sig; struct GNUNET_TIME_Absolute now; @@ -123,81 +122,26 @@ wire_del_run (void *cls, } else { - char *fn; - struct TALER_MasterPrivateKeyP master_priv; - - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (is->cfg, - "exchange-offline", - "MASTER_PRIV_FILE", - &fn)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange-offline", - "MASTER_PRIV_FILE"); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_SYSERR == - GNUNET_DISK_directory_create_for_file (fn)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not setup directory for master private key file `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_YES, - &master_priv.eddsa_priv)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not load master private key from `%s'\n", - fn); - GNUNET_free (fn); - TALER_TESTING_interpreter_next (ds->is); - return; - } - GNUNET_free (fn); - - /* now sign */ - { - struct TALER_MasterDelWirePS kv = { - .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_WIRE), - .purpose.size = htonl (sizeof (kv)), - .end_date = GNUNET_TIME_absolute_hton (now), - }; + struct TALER_MasterDelWirePS kv = { + .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_WIRE), + .purpose.size = htonl (sizeof (kv)), + .end_date = GNUNET_TIME_absolute_hton (now), + }; - TALER_exchange_wire_signature_hash (ds->payto_uri, - &kv.h_wire); - GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, - &kv, - &master_sig.eddsa_signature); - } - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (is->cfg, - "exchange", - "BASE_URL", - &exchange_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange", - "BASE_URL"); - TALER_TESTING_interpreter_next (ds->is); - return; + TALER_exchange_wire_signature_hash (ds->payto_uri, + &kv.h_wire); + GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, + &kv, + &master_sig.eddsa_signature); } ds->dh = TALER_EXCHANGE_management_disable_wire ( is->ctx, - exchange_url, + is->exchange_url, ds->payto_uri, now, &master_sig, &wire_del_cb, ds); - GNUNET_free (exchange_url); if (NULL == ds->dh) { GNUNET_break (0); diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c index aedb33fc9..88af481ea 100644 --- a/src/testing/testing_api_loop.c +++ b/src/testing/testing_api_loop.c @@ -751,6 +751,124 @@ main_wrapper_exchange_connect (void *cls) /** + * Load the exchange and auditor key material into @a is. + * + * @param[in,out] is state to initialize + */ +static int +load_keys (struct TALER_TESTING_Interpreter *is) +{ + char *fn; + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_filename (is->cfg, + "exchange-offline", + "MASTER_PRIV_FILE", + &fn)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + "exchange-offline", + "MASTER_PRIV_FILE"); + return GNUNET_SYSERR; + } + if (GNUNET_SYSERR == + GNUNET_DISK_directory_create_for_file (fn)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Could not setup directory for master private key file `%s'\n", + fn); + GNUNET_free (fn); + return GNUNET_SYSERR; + } + if (GNUNET_SYSERR == + GNUNET_CRYPTO_eddsa_key_from_file (fn, + GNUNET_YES, + &is->master_priv.eddsa_priv)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Could not load master private key from `%s'\n", + fn); + GNUNET_free (fn); + return GNUNET_SYSERR; + } + GNUNET_free (fn); + GNUNET_CRYPTO_eddsa_key_get_public (&is->master_priv.eddsa_priv, + &is->master_pub.eddsa_pub); + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_filename (is->cfg, + "auditor", + "AUDITOR_PRIV_FILE", + &fn)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + "auditor", + "AUDITOR_PRIV_FILE"); + return GNUNET_SYSERR; + } + if (GNUNET_SYSERR == + GNUNET_DISK_directory_create_for_file (fn)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Could not setup directory for auditor private key file `%s'\n", + fn); + GNUNET_free (fn); + return GNUNET_SYSERR; + } + if (GNUNET_SYSERR == + GNUNET_CRYPTO_eddsa_key_from_file (fn, + GNUNET_YES, + &is->auditor_priv.eddsa_priv)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Could not load auditor private key from `%s'\n", + fn); + GNUNET_free (fn); + return GNUNET_SYSERR; + } + GNUNET_free (fn); + GNUNET_CRYPTO_eddsa_key_get_public (&is->auditor_priv.eddsa_priv, + &is->auditor_pub.eddsa_pub); + return GNUNET_OK; +} + + +/** + * Load the exchange and auditor URLs from the configuration into @a is. + * + * @param[in,out] is state to initialize + */ +static int +load_urls (struct TALER_TESTING_Interpreter *is) +{ + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_filename (is->cfg, + "auditor", + "BASE_URL", + &is->auditor_url)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + "auditor", + "BASE_URL"); + return GNUNET_SYSERR; + } + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_string (is->cfg, + "exchange", + "BASE_URL", + &is->exchange_url)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + "exchange", + "BASE_URL"); + GNUNET_free (is->auditor_url); + return GNUNET_SYSERR; + } + return GNUNET_OK; +} + + +/** * Install signal handlers plus schedules the main wrapper * around the "run" method. * @@ -790,6 +908,12 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb, sizeof (is)); is.exchanged = exchanged; is.cfg = cfg; + if (GNUNET_OK != + load_keys (&is)) + return GNUNET_SYSERR; + if (GNUNET_OK != + load_urls (&is)) + return GNUNET_SYSERR; sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE); GNUNET_assert (NULL != sigpipe); shc_chld = GNUNET_SIGNAL_handler_install @@ -802,8 +926,8 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb, GNUNET_assert (NULL != is.ctx); is.rc = GNUNET_CURL_gnunet_rc_create (is.ctx); - /* Blocking */ + /* Blocking */ if (GNUNET_YES == exchange_connect) GNUNET_SCHEDULER_run (&main_wrapper_exchange_connect, &main_ctx); @@ -816,6 +940,8 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb, GNUNET_SIGNAL_handler_uninstall (shc_chld); GNUNET_DISK_pipe_close (sigpipe); sigpipe = NULL; + GNUNET_free (is.auditor_url); + GNUNET_free (is.exchange_url); return is.result; } |