commit 1d778d852f1135b48c3f7a868e12a647dde40669
parent 53ef71657a7c10c6cc6b91f1b18fd57e86bf40da
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 24 Aug 2022 13:04:36 +0200
fix crash on retry limit exceeded for security question
Diffstat:
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/backend/anastasis-httpd_truth-solve.c b/src/backend/anastasis-httpd_truth-solve.c
@@ -199,14 +199,24 @@ static struct GNUNET_SCHEDULER_Task *to_task;
static MHD_RESULT
reply_rate_limited (const struct SolveContext *gc)
{
+ if (NULL != gc->authorization)
+ return TALER_MHD_REPLY_JSON_PACK (
+ gc->connection,
+ MHD_HTTP_TOO_MANY_REQUESTS,
+ TALER_MHD_PACK_EC (TALER_EC_ANASTASIS_TRUTH_RATE_LIMITED),
+ GNUNET_JSON_pack_uint64 ("request_limit",
+ gc->authorization->retry_counter),
+ GNUNET_JSON_pack_time_rel ("request_frequency",
+ gc->authorization->code_rotation_period));
+ /* must be security question */
return TALER_MHD_REPLY_JSON_PACK (
gc->connection,
MHD_HTTP_TOO_MANY_REQUESTS,
TALER_MHD_PACK_EC (TALER_EC_ANASTASIS_TRUTH_RATE_LIMITED),
GNUNET_JSON_pack_uint64 ("request_limit",
- gc->authorization->retry_counter),
+ INITIAL_RETRY_COUNTER),
GNUNET_JSON_pack_time_rel ("request_frequency",
- gc->authorization->code_rotation_period));
+ MAX_QUESTION_FREQ));
}