commit 9e92cc608932abc6caf53dce7cd96984f793f4e3
parent 8f0a4b6095fd05e101fc5389cc46ec211083979a
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 15 Jul 2020 21:41:09 +0200
Fix #6375
Diffstat:
6 files changed, 26 insertions(+), 31 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);