From 9e92cc608932abc6caf53dce7cd96984f793f4e3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 15 Jul 2020 21:41:09 +0200 Subject: Fix #6375 --- src/auditor/report-lib.c | 14 ++++++++------ src/auditor/taler-helper-auditor-wire.c | 4 ---- src/exchange-tools/taler-exchange-keyup.c | 21 ++++----------------- src/exchange/taler-exchange-aggregator.c | 2 +- src/exchange/taler-exchange-closer.c | 2 +- src/util/config.c | 14 ++++++++++++-- 6 files changed, 26 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c index 0956bcaee..4aa8b45b6 100644 --- a/src/auditor/report-lib.c +++ b/src/auditor/report-lib.c @@ -701,14 +701,16 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c) return GNUNET_SYSERR; } { - if (GNUNET_OK != - TALER_config_get_amount (TALER_ARL_cfg, - "taler", - "CURRENCY_ROUND_UNIT", - &TALER_ARL_currency_round_unit)) + if ( (GNUNET_OK != + TALER_config_get_amount (TALER_ARL_cfg, + "taler", + "CURRENCY_ROUND_UNIT", + &TALER_ARL_currency_round_unit)) || + ( (0 != TALER_ARL_currency_round_unit.fraction) && + (0 != TALER_ARL_currency_round_unit.value) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Invalid or missing amount in `TALER' under `CURRENCY_ROUND_UNIT'\n"); + "Need non-zero value in section `TALER' under `CURRENCY_ROUND_UNIT'\n"); return GNUNET_SYSERR; } } diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c index 7eb3a0473..5e5d16748 100644 --- a/src/auditor/taler-helper-auditor-wire.c +++ b/src/auditor/taler-helper-auditor-wire.c @@ -2076,10 +2076,6 @@ run (void *cls, "TINY_AMOUNT", &tiny_amount)) { - GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, - "auditor", - "TINY_AMOUNT", - "invalid amount"); global_ret = 1; return; } diff --git a/src/exchange-tools/taler-exchange-keyup.c b/src/exchange-tools/taler-exchange-keyup.c index 0ea661d49..d72c2d350 100644 --- a/src/exchange-tools/taler-exchange-keyup.c +++ b/src/exchange-tools/taler-exchange-keyup.c @@ -679,9 +679,6 @@ get_denomination_type_params (const char *ct, "VALUE", ¶ms->value)) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - ct, - "VALUE"); return GNUNET_SYSERR; } if (GNUNET_OK != @@ -690,9 +687,6 @@ get_denomination_type_params (const char *ct, "FEE_WITHDRAW", ¶ms->fee_withdraw)) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - ct, - "FEE_WITHDRAW"); return GNUNET_SYSERR; } if (GNUNET_OK != @@ -701,9 +695,6 @@ get_denomination_type_params (const char *ct, "FEE_DEPOSIT", ¶ms->fee_deposit)) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - ct, - "FEE_DEPOSIT"); return GNUNET_SYSERR; } if (GNUNET_OK != @@ -712,9 +703,6 @@ get_denomination_type_params (const char *ct, "FEE_REFRESH", ¶ms->fee_refresh)) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - ct, - "FEE_REFRESH"); return GNUNET_SYSERR; } if (GNUNET_OK != @@ -723,9 +711,6 @@ get_denomination_type_params (const char *ct, "fee_refund", ¶ms->fee_refund)) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - ct, - "FEE_REFUND"); return GNUNET_SYSERR; } @@ -1016,7 +1001,8 @@ create_wire_fee_for_method (void *cls, af->wire_fee.currency)) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Invalid or missing amount for option `%s' in section `%s'\n", + "Need amount with currency `%s' for option `%s' in section `%s'\n", + currency, opt, section); *ret = GNUNET_SYSERR; @@ -1038,7 +1024,8 @@ create_wire_fee_for_method (void *cls, af->closing_fee.currency)) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Invalid or missing amount for option `%s' in section `%s'\n", + "Need amount with currency `%s' for option `%s' in section `%s'\n", + currency, opt, section); *ret = GNUNET_SYSERR; diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c index 270a13301..08892800b 100644 --- a/src/exchange/taler-exchange-aggregator.c +++ b/src/exchange/taler-exchange-aggregator.c @@ -269,7 +269,7 @@ parse_wirewatch_config (void) (0 != currency_round_unit.value) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Invalid value specified in section `TALER' under `CURRENCY_ROUND_UNIT'\n"); + "Need non-zero value in section `TALER' under `CURRENCY_ROUND_UNIT'\n"); return GNUNET_SYSERR; } diff --git a/src/exchange/taler-exchange-closer.c b/src/exchange/taler-exchange-closer.c index 542489434..63d7d4eec 100644 --- a/src/exchange/taler-exchange-closer.c +++ b/src/exchange/taler-exchange-closer.c @@ -161,7 +161,7 @@ parse_wirewatch_config (void) (0 != currency_round_unit.value) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Invalid value specified in section `TALER' under `CURRENCY_ROUND_UNIT'\n"); + "Need non-zero amount in section `TALER' under `CURRENCY_ROUND_UNIT'\n"); return GNUNET_SYSERR; } diff --git a/src/util/config.c b/src/util/config.c index 160d541f0..e533a4ec3 100644 --- a/src/util/config.c +++ b/src/util/config.c @@ -45,11 +45,21 @@ TALER_config_get_amount (const struct GNUNET_CONFIGURATION_Handle *cfg, section, option, &str)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + section, + option); return GNUNET_NO; - if (GNUNET_OK != TALER_string_to_amount (str, - denom)) + } + if (GNUNET_OK != + TALER_string_to_amount (str, + denom)) { GNUNET_free (str); + GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, + section, + option, + "valid amount"); return GNUNET_SYSERR; } GNUNET_free (str); -- cgit v1.2.3