summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-08-24 13:04:36 +0200
committerChristian Grothoff <christian@grothoff.org>2022-08-24 13:04:36 +0200
commit1d778d852f1135b48c3f7a868e12a647dde40669 (patch)
treebf36256396e797d27a4ddd1d0cc006ed65f8b630 /src
parent53ef71657a7c10c6cc6b91f1b18fd57e86bf40da (diff)
downloadanastasis-1d778d852f1135b48c3f7a868e12a647dde40669.tar.gz
anastasis-1d778d852f1135b48c3f7a868e12a647dde40669.tar.bz2
anastasis-1d778d852f1135b48c3f7a868e12a647dde40669.zip
fix crash on retry limit exceeded for security question
Diffstat (limited to 'src')
-rw-r--r--src/backend/anastasis-httpd_truth-solve.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/backend/anastasis-httpd_truth-solve.c b/src/backend/anastasis-httpd_truth-solve.c
index a632e6b..957d924 100644
--- 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));
}