commit ac98fa5e3b275ee010e72cd5446a9a03632867ed
parent 1740139dfad7008dbb7e944d052cef605724275d
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 18 Feb 2024 11:12:58 +0100
-misc bugfixes
Diffstat:
3 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/src/challenger/challenger-httpd_authorize.c b/src/challenger/challenger-httpd_authorize.c
@@ -191,6 +191,9 @@ CH_handler_authorize (struct CH_HandlerContext *hc,
enum GNUNET_GenericReturnValue ret;
json_t *args;
char *form;
+ struct MHD_Response *resp;
+ unsigned int http_status;
+ MHD_RESULT res;
GNUNET_asprintf (&form,
"enter-%s-form",
@@ -206,13 +209,15 @@ CH_handler_authorize (struct CH_HandlerContext *hc,
GNUNET_JSON_pack_uint64 ("changes_left",
address_attempts_left)
);
- ret = TALER_TEMPLATING_reply (
+ http_status = MHD_HTTP_OK;
+ ret = TALER_TEMPLATING_build (
hc->connection,
- MHD_HTTP_OK,
+ &http_status,
form,
NULL,
NULL,
- args);
+ args,
+ &resp);
GNUNET_free (form);
json_decref (args);
if (GNUNET_SYSERR == ret)
@@ -221,7 +226,15 @@ CH_handler_authorize (struct CH_HandlerContext *hc,
return MHD_NO;
}
GNUNET_break (GNUNET_OK == ret);
- return MHD_YES;
+ GNUNET_break (MHD_YES ==
+ MHD_add_response_header (resp,
+ MHD_HTTP_HEADER_CACHE_CONTROL,
+ "no-store,no-cache"));
+ res = MHD_queue_response (hc->connection,
+ http_status,
+ resp);
+ MHD_destroy_response (resp);
+ return res;
}
}
}
diff --git a/src/challenger/challenger-httpd_challenge.c b/src/challenger/challenger-httpd_challenge.c
@@ -607,6 +607,9 @@ CH_handler_challenge (struct CH_HandlerContext *hc,
{
json_t *args;
enum GNUNET_GenericReturnValue ret;
+ struct MHD_Response *resp;
+ unsigned int http_status;
+ MHD_RESULT res;
args = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("attempts_left",
@@ -623,12 +626,14 @@ CH_handler_challenge (struct CH_HandlerContext *hc,
bc->last_tx_time,
CH_validation_duration)))
);
- ret = TALER_TEMPLATING_reply (hc->connection,
- MHD_HTTP_OK,
+ http_status = MHD_HTTP_OK;
+ ret = TALER_TEMPLATING_build (hc->connection,
+ &http_status,
"enter-tan-form",
NULL,
NULL,
- args);
+ args,
+ &resp);
json_decref (args);
if (GNUNET_SYSERR == ret)
{
@@ -636,6 +641,14 @@ CH_handler_challenge (struct CH_HandlerContext *hc,
return MHD_NO;
}
GNUNET_break (GNUNET_OK == ret);
- return MHD_YES;
+ GNUNET_break (MHD_YES ==
+ MHD_add_response_header (resp,
+ MHD_HTTP_HEADER_CACHE_CONTROL,
+ "no-store,no-cache"));
+ res = MHD_queue_response (hc->connection,
+ http_status,
+ resp);
+ MHD_destroy_response (resp);
+ return res;
}
}
diff --git a/src/challengerdb/challenger_do_validate_and_solve_pin.sql b/src/challengerdb/challenger_do_validate_and_solve_pin.sql
@@ -79,7 +79,7 @@ ELSE
END IF;
UPDATE validations
- SET auth_attempts_left=my_status.auth_attempts_left
+ SET auth_attempts_left=out_auth_attempts_left
WHERE nonce=$1;
RETURN;