diff options
Diffstat (limited to 'src/exchange-tools/taler-exchange-offline.c')
-rw-r--r-- | src/exchange-tools/taler-exchange-offline.c | 294 |
1 files changed, 181 insertions, 113 deletions
diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c index fed29437e..1f10c55e3 100644 --- a/src/exchange-tools/taler-exchange-offline.c +++ b/src/exchange-tools/taler-exchange-offline.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2020-2023 Taler Systems SA + Copyright (C) 2020-2024 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 @@ -918,9 +918,10 @@ do_shutdown (void *cls) if (NULL != out) { - json_dumpf (out, - stdout, - JSON_INDENT (2)); + if (EXIT_SUCCESS == global_ret) + json_dumpf (out, + stdout, + JSON_INDENT (2)); json_decref (out); out = NULL; } @@ -1189,7 +1190,7 @@ upload_denom_revocation (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } drr = GNUNET_new (struct DenomRevocationRequest); @@ -1279,7 +1280,7 @@ upload_signkey_revocation (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } srr = GNUNET_new (struct SignkeyRevocationRequest); @@ -1350,7 +1351,7 @@ upload_auditor_add (const char *exchange_url, const char *err_name; unsigned int err_line; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_string ("auditor_url", + TALER_JSON_spec_web_url ("auditor_url", &auditor_url), GNUNET_JSON_spec_string ("auditor_name", &auditor_name), @@ -1378,7 +1379,7 @@ upload_auditor_add (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } aar = GNUNET_new (struct AuditorAddRequest); @@ -1474,7 +1475,7 @@ upload_auditor_del (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } adr = GNUNET_new (struct AuditorDelRequest); @@ -1543,16 +1544,24 @@ upload_wire_add (const char *exchange_url, struct WireAddRequest *war; const char *err_name; const char *conversion_url = NULL; + const char *bank_label = NULL; + int64_t priority = 0; const json_t *debit_restrictions; const json_t *credit_restrictions; unsigned int err_line; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_string ("payto_uri", - &payto_uri), + TALER_JSON_spec_payto_uri ("payto_uri", + &payto_uri), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_string ("conversion_url", + TALER_JSON_spec_web_url ("conversion_url", &conversion_url), NULL), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_string ("bank_label", + &bank_label), + NULL), + GNUNET_JSON_spec_int64 ("priority", + &priority), GNUNET_JSON_spec_array_const ("debit_restrictions", &debit_restrictions), GNUNET_JSON_spec_array_const ("credit_restrictions", @@ -1581,7 +1590,7 @@ upload_wire_add (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } { @@ -1594,7 +1603,7 @@ upload_wire_add (const char *exchange_url, "payto:// URI `%s' is malformed\n", payto_uri); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } GNUNET_free (wire_method); @@ -1608,7 +1617,7 @@ upload_wire_add (const char *exchange_url, "payto URI is malformed: %s\n", msg); GNUNET_free (msg); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -1625,6 +1634,8 @@ upload_wire_add (const char *exchange_url, start_time, &master_sig_add, &master_sig_wire, + bank_label, + priority, &wire_add_cb, war); GNUNET_CONTAINER_DLL_insert (war_head, @@ -1683,8 +1694,8 @@ upload_wire_del (const char *exchange_url, const char *err_name; unsigned int err_line; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_string ("payto_uri", - &payto_uri), + TALER_JSON_spec_payto_uri ("payto_uri", + &payto_uri), GNUNET_JSON_spec_timestamp ("validity_end", &end_time), GNUNET_JSON_spec_fixed_auto ("master_sig", @@ -1707,7 +1718,7 @@ upload_wire_del (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } wdr = GNUNET_new (struct WireDelRequest); @@ -1811,7 +1822,7 @@ upload_wire_fee (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } wfr = GNUNET_new (struct WireFeeRequest); @@ -1926,7 +1937,7 @@ upload_global_fee (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } gfr = GNUNET_new (struct GlobalFeeRequest); @@ -2012,8 +2023,8 @@ upload_drain (const char *exchange_url, &date), GNUNET_JSON_spec_string ("account_section", &account_section), - GNUNET_JSON_spec_string ("payto_uri", - &payto_uri), + TALER_JSON_spec_payto_uri ("payto_uri", + &payto_uri), GNUNET_JSON_spec_fixed_auto ("master_sig", &master_sig), GNUNET_JSON_spec_end () @@ -2034,7 +2045,7 @@ upload_drain (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } dpr = GNUNET_new (struct DrainProfitsRequest); @@ -2129,7 +2140,7 @@ upload_keys (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } pkd.num_sign_sigs = json_array_size (signkey_sigs); @@ -2222,7 +2233,7 @@ upload_keys (const char *exchange_url, else { global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); } GNUNET_free (pkd.sign_sigs); GNUNET_free (pkd.denom_sigs); @@ -2301,7 +2312,7 @@ upload_extensions (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } @@ -2316,7 +2327,7 @@ upload_extensions (const char *exchange_url, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "couldn't hash extensions' manifests\n"); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } @@ -2332,7 +2343,7 @@ upload_extensions (const char *exchange_url, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "invalid signature for extensions\n"); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } } @@ -2424,7 +2435,7 @@ add_partner (const char *exchange_url, &start_date), GNUNET_JSON_spec_timestamp ("end_date", &end_date), - GNUNET_JSON_spec_string ("partner_base_url", + TALER_JSON_spec_web_url ("partner_base_url", &partner_base_url), GNUNET_JSON_spec_fixed_auto ("master_sig", &master_sig), @@ -2448,7 +2459,7 @@ add_partner (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } par = GNUNET_new (struct PartnerAddRequest); @@ -2555,7 +2566,7 @@ update_aml_staff (const char *exchange_url, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } asr = GNUNET_new (struct AmlStaffRequest); @@ -2658,7 +2669,7 @@ trigger_upload (const char *exchange_url) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed JSON input\n"); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } /* block of code that uses key and value */ @@ -2681,7 +2692,7 @@ trigger_upload (const char *exchange_url) "Upload does not know how to handle `%s'\n", key); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } } @@ -2701,7 +2712,7 @@ do_upload (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, refusing upload\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -2720,7 +2731,7 @@ do_upload (char *const *args) err.line, err.source, err.position); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -2729,7 +2740,7 @@ do_upload (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error: expected JSON array for `upload` command\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -2744,7 +2755,7 @@ do_upload (char *const *args) "exchange", "BASE_URL"); global_ret = EXIT_NOTCONFIGURED; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } trigger_upload (CFG_exchange_url); @@ -2769,7 +2780,7 @@ do_revoke_denomination_key (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, refusing revocation\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -2782,7 +2793,7 @@ do_revoke_denomination_key (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify a denomination key with this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -2818,7 +2829,7 @@ do_revoke_signkey (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, refusing revocation\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -2831,7 +2842,7 @@ do_revoke_signkey (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify an exchange signing key with this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -2869,7 +2880,7 @@ do_add_auditor (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, not adding auditor\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -2882,7 +2893,7 @@ do_add_auditor (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify an auditor public key as first argument for this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -2895,7 +2906,7 @@ do_add_auditor (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify an auditor URI and auditor name as 2nd and 3rd arguments to this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -2941,7 +2952,7 @@ do_del_auditor (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, not deleting auditor account\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -2954,7 +2965,7 @@ do_del_auditor (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify an auditor public key as first argument for this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3052,7 +3063,7 @@ parse_restriction (char *const *args, GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("type", "regex"), - GNUNET_JSON_pack_string ("regex", + GNUNET_JSON_pack_string ("payto_regex", args[1]), GNUNET_JSON_pack_string ("human_hint", args[2]), @@ -3081,6 +3092,8 @@ do_add_wire (char *const *args) struct TALER_MasterSignatureP master_sig_wire; struct GNUNET_TIME_Timestamp now; const char *conversion_url = NULL; + const char *bank_label = NULL; + int64_t priority = 0; json_t *debit_restrictions; json_t *credit_restrictions; unsigned int num_args = 1; @@ -3089,7 +3102,7 @@ do_add_wire (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, not adding wire account\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -3097,7 +3110,7 @@ do_add_wire (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify a payto://-URI with this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3113,7 +3126,7 @@ do_add_wire (char *const *args) "payto URI is malformed: %s\n", msg); GNUNET_free (msg); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3129,7 +3142,7 @@ do_add_wire (char *const *args) "payto:// URI `%s' is malformed\n", args[0]); global_ret = EXIT_INVALIDARGUMENT; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return; } GNUNET_free (wire_method); @@ -3150,7 +3163,18 @@ do_add_wire (char *const *args) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "'conversion-url' requires an argument\n"); global_ret = EXIT_INVALIDARGUMENT; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); + json_decref (debit_restrictions); + json_decref (credit_restrictions); + return; + } + if (! TALER_is_web_url (conversion_url)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "'conversion-url' must refer to HTTP(S) endpoint, `%s' is invalid\n", + conversion_url); + global_ret = EXIT_INVALIDARGUMENT; + GNUNET_SCHEDULER_shutdown (); json_decref (debit_restrictions); json_decref (credit_restrictions); return; @@ -3169,7 +3193,7 @@ do_add_wire (char *const *args) if (iret <= 0) { global_ret = EXIT_INVALIDARGUMENT; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); json_decref (debit_restrictions); json_decref (credit_restrictions); return; @@ -3188,7 +3212,7 @@ do_add_wire (char *const *args) if (iret <= 0) { global_ret = EXIT_INVALIDARGUMENT; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); json_decref (debit_restrictions); json_decref (credit_restrictions); return; @@ -3196,6 +3220,44 @@ do_add_wire (char *const *args) num_args += iret; continue; } + if (0 == strcmp (args[num_args], + "display-hint")) + { + long long p; + char dummy; + + num_args++; + if ( (NULL == args[num_args]) || + (NULL == args[num_args + 1]) ) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "'display-hint' requires at least two arguments (priority and label)\n"); + global_ret = EXIT_INVALIDARGUMENT; + GNUNET_SCHEDULER_shutdown (); + json_decref (debit_restrictions); + json_decref (credit_restrictions); + return; + } + if (1 != sscanf (args[num_args], + "%lld%c", + &p, + &dummy)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Priority argument `%s' is not a number\n", + args[num_args]); + global_ret = EXIT_INVALIDARGUMENT; + GNUNET_SCHEDULER_shutdown (); + json_decref (debit_restrictions); + json_decref (credit_restrictions); + return; + } + priority = (int64_t) p; + num_args++; + bank_label = args[num_args]; + num_args++; + continue; + } break; } TALER_exchange_offline_wire_add_sign (args[0], @@ -3222,6 +3284,11 @@ do_add_wire (char *const *args) GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_string ("conversion_url", conversion_url)), + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_string ("bank_label", + bank_label)), + GNUNET_JSON_pack_int64 ("priority", + priority), GNUNET_JSON_pack_timestamp ("validity_start", now), GNUNET_JSON_pack_data_auto ("master_sig_add", @@ -3248,7 +3315,7 @@ do_del_wire (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, not deleting wire account\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -3256,7 +3323,7 @@ do_del_wire (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify a payto://-URI with this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3301,7 +3368,7 @@ do_set_wire_fee (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, not setting wire fee\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -3324,7 +3391,7 @@ do_set_wire_fee (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must use YEAR, METHOD, WIRE-FEE, and CLOSING-FEE as arguments for this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3388,7 +3455,7 @@ do_set_global_fee (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, not setting global fee\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -3402,7 +3469,7 @@ do_set_global_fee (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must use YEAR, HISTORY-FEE, ACCOUNT-FEE, PURSE-FEE, PURSE-TIMEOUT, HISTORY-EXPIRATION and PURSE-ACCOUNT-LIMIT as arguments for this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3415,7 +3482,7 @@ do_set_global_fee (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid YEAR given for 'global-fee' subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3431,7 +3498,7 @@ do_set_global_fee (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid amount given for 'global-fee' subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3444,7 +3511,7 @@ do_set_global_fee (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid delay given for 'global-fee' subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3455,7 +3522,7 @@ do_set_global_fee (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid purse account limit given for 'global-fee' subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3526,7 +3593,7 @@ do_drain (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, refusing drain\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -3539,7 +3606,7 @@ do_drain (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Drain requires an amount, section name and target payto://-URI as arguments\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3549,7 +3616,7 @@ do_drain (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Drain requires an amount, section name and target payto://-URI as arguments\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3560,7 +3627,7 @@ do_drain (char *const *args) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid amount `%s' specified for drain\n", args[0]); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3574,7 +3641,7 @@ do_drain (char *const *args) payto_uri, err); GNUNET_free (err); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3635,7 +3702,7 @@ do_add_partner (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, not adding partner\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -3648,7 +3715,7 @@ do_add_partner (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify the partner master public key as first argument for this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3659,7 +3726,7 @@ do_add_partner (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify the partner's base URL as the 2nd argument to this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3672,7 +3739,7 @@ do_add_partner (char *const *args) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid amount `%s' specified for wad fee of partner\n", args[2]); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3684,7 +3751,7 @@ do_add_partner (char *const *args) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid wad frequency `%s' specified for add partner\n", args[3]); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3699,7 +3766,7 @@ do_add_partner (char *const *args) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid year `%s' specified for add partner\n", args[4]); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3761,7 +3828,7 @@ do_set_aml_staff (bool is_active, { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Downloaded data was not consumed, not updating AML staff status\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -3774,7 +3841,7 @@ do_set_aml_staff (bool is_active, { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify the AML officer's public key as first argument for this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3782,7 +3849,7 @@ do_set_aml_staff (bool is_active, { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify the officer's legal name as the 2nd argument to this subcommand\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3798,7 +3865,7 @@ do_set_aml_staff (bool is_active, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must specify 'ro' or 'rw' (and not `%s') for the access level\n", args[2]); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -3897,7 +3964,7 @@ download_cb (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to download keys from `%s' (no HTTP response)\n", CFG_exchange_url); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_FAILURE; return; } @@ -3936,7 +4003,7 @@ do_download (char *const *args) GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "exchange", "BASE_URL"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_NOTCONFIGURED; return; } @@ -4189,7 +4256,7 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return GNUNET_SYSERR; } duration = GNUNET_TIME_absolute_get_difference (start_time.abs_time, @@ -4205,7 +4272,7 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub, "Invalid security module signature for signing key %s (aborting)\n", TALER_B2S (&exchange_pub)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return GNUNET_SYSERR; } { @@ -4297,7 +4364,7 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa, JSON_INDENT (2)); GNUNET_JSON_parse_free (spec); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return GNUNET_SYSERR; } duration = GNUNET_TIME_absolute_get_difference ( @@ -4305,13 +4372,13 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa, stamp_expire_withdraw.abs_time); TALER_denom_pub_hash (&denom_pub, &h_denom_pub); - switch (denom_pub.cipher) + switch (denom_pub.bsign_pub_key->cipher) { - case TALER_DENOMINATION_RSA: + case GNUNET_CRYPTO_BSA_RSA: { struct TALER_RsaPubHashP h_rsa; - TALER_rsa_pub_hash (denom_pub.details.rsa_public_key, + TALER_rsa_pub_hash (denom_pub.bsign_pub_key->details.rsa_public_key, &h_rsa); ok = TALER_exchange_secmod_rsa_verify (&h_rsa, section_name, @@ -4321,11 +4388,11 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa, &secm_sig); } break; - case TALER_DENOMINATION_CS: + case GNUNET_CRYPTO_BSA_CS: { struct TALER_CsPubHashP h_cs; - TALER_cs_pub_hash (&denom_pub.details.cs_public_key, + TALER_cs_pub_hash (&denom_pub.bsign_pub_key->details.cs_public_key, &h_cs); ok = TALER_exchange_secmod_cs_verify (&h_cs, section_name, @@ -4346,7 +4413,7 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa, "Invalid security module signature for denomination key %s (aborting)\n", GNUNET_h2s (&h_denom_pub.hash)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return GNUNET_SYSERR; } @@ -4433,7 +4500,7 @@ parse_keys_input (const char *command_name) err.source, err.position); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return NULL; } } @@ -4452,7 +4519,7 @@ parse_keys_input (const char *command_name) stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return NULL; } if (0 != strcmp (op_str, @@ -4524,7 +4591,7 @@ do_show (char *const *args) stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); json_decref (keys); return; } @@ -4535,7 +4602,7 @@ do_show (char *const *args) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fatal: exchange uses different master key!\n"); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); json_decref (keys); return; } @@ -4543,7 +4610,7 @@ do_show (char *const *args) tofu_check (&secmset)) { global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); json_decref (keys); return; } @@ -4556,7 +4623,7 @@ do_show (char *const *args) denomkeys)) ) { global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); json_decref (keys); return; } @@ -4619,7 +4686,7 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub, stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return GNUNET_SYSERR; } @@ -4636,7 +4703,7 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub, "Invalid security module signature for signing key %s (aborting)\n", TALER_B2S (&exchange_pub)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); GNUNET_JSON_parse_free (spec); return GNUNET_SYSERR; } @@ -4773,7 +4840,7 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa, JSON_INDENT (2)); GNUNET_JSON_parse_free (spec); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); return GNUNET_SYSERR; } duration = GNUNET_TIME_absolute_get_difference ( @@ -4785,13 +4852,14 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa, TALER_denom_pub_hash (&denom_pub, &h_denom_pub); - switch (denom_pub.cipher) + + switch (denom_pub.bsign_pub_key->cipher) { - case TALER_DENOMINATION_RSA: + case GNUNET_CRYPTO_BSA_RSA: { struct TALER_RsaPubHashP h_rsa; - TALER_rsa_pub_hash (denom_pub.details.rsa_public_key, + TALER_rsa_pub_hash (denom_pub.bsign_pub_key->details.rsa_public_key, &h_rsa); if (GNUNET_OK != TALER_exchange_secmod_rsa_verify (&h_rsa, @@ -4805,17 +4873,17 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa, "Invalid security module signature for denomination key %s (aborting)\n", GNUNET_h2s (&h_denom_pub.hash)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); GNUNET_JSON_parse_free (spec); return GNUNET_SYSERR; } } break; - case TALER_DENOMINATION_CS: + case GNUNET_CRYPTO_BSA_CS: { struct TALER_CsPubHashP h_cs; - TALER_cs_pub_hash (&denom_pub.details.cs_public_key, + TALER_cs_pub_hash (&denom_pub.bsign_pub_key->details.cs_public_key, &h_cs); if (GNUNET_OK != TALER_exchange_secmod_cs_verify (&h_cs, @@ -4829,7 +4897,7 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa, "Invalid security module signature for denomination key %s (aborting)\n", GNUNET_h2s (&h_denom_pub.hash)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); GNUNET_JSON_parse_free (spec); return GNUNET_SYSERR; } @@ -4837,7 +4905,7 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa, break; default: global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); GNUNET_JSON_parse_free (spec); return GNUNET_SYSERR; } @@ -4923,7 +4991,7 @@ do_sign (char *const *args) stderr, JSON_INDENT (2)); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); json_decref (keys); return; } @@ -4934,7 +5002,7 @@ do_sign (char *const *args) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fatal: exchange uses different master key!\n"); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); json_decref (keys); return; } @@ -4944,7 +5012,7 @@ do_sign (char *const *args) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fatal: security module keys changed!\n"); global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); json_decref (keys); return; } @@ -4965,7 +5033,7 @@ do_sign (char *const *args) denomkey_sig_array)) ) { global_ret = EXIT_FAILURE; - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); json_decref (signkey_sig_array); json_decref (denomkey_sig_array); json_decref (keys); @@ -5198,7 +5266,7 @@ do_work_extensions (char *const *args) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "You must provide a subcommand: `show` or `sign`.\n"); - test_shutdown (); + GNUNET_SCHEDULER_shutdown (); global_ret = EXIT_INVALIDARGUMENT; return; } @@ -5262,7 +5330,7 @@ work (void *cls) { .name = "enable-account", .help = - "enable wire account of the exchange (payto-URI must be given as argument; for optional argument see man page)", + "enable wire account of the exchange (payto-URI must be given as argument; for optional arguments see man page)", .cb = &do_add_wire }, { |