diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-08-24 13:04:36 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-08-24 13:04:36 +0200 |
commit | 1d778d852f1135b48c3f7a868e12a647dde40669 (patch) | |
tree | bf36256396e797d27a4ddd1d0cc006ed65f8b630 /src/backend | |
parent | 53ef71657a7c10c6cc6b91f1b18fd57e86bf40da (diff) | |
download | anastasis-1d778d852f1135b48c3f7a868e12a647dde40669.tar.gz anastasis-1d778d852f1135b48c3f7a868e12a647dde40669.tar.bz2 anastasis-1d778d852f1135b48c3f7a868e12a647dde40669.zip |
fix crash on retry limit exceeded for security question
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/anastasis-httpd_truth-solve.c | 14 |
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)); } |