commit d385bca3478cdc2e9a016f769997d90e050fcdb6
parent 01621e943466a3a938276918c8e9a63811e39a3a
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 13 Aug 2026 21:20:36 +0200
handle 2nd AML decision in same second properly in exchange, fails tops-aml-pdf now
Diffstat:
3 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_post-aml-OFFICER_PUB-decision.c b/src/exchange/taler-exchange-httpd_post-aml-OFFICER_PUB-decision.c
@@ -429,7 +429,7 @@ TEH_handler_post_aml_decision (
&legi_measure_serial_id,
&is_wallet);
json_decref (jmeasures);
- if (qs <= 0)
+ if (qs < 0)
{
GNUNET_break (0);
ret = TALER_MHD_reply_with_error (
@@ -439,6 +439,16 @@ TEH_handler_post_aml_decision (
"insert_aml_decision");
goto done;
}
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ GNUNET_break_op (0);
+ ret = TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_CONFLICT,
+ TALER_EC_EXCHANGE_AML_DECISION_MORE_RECENT_PRESENT,
+ NULL);
+ goto done;
+ }
if (invalid_officer)
{
GNUNET_break_op (0);
diff --git a/src/exchange/taler-exchange-httpd_post-kyc-upload-ID.c b/src/exchange/taler-exchange-httpd_post-kyc-upload-ID.c
@@ -51,6 +51,11 @@ struct UploadContext
struct TALER_AccountAccessTokenP access_token;
/**
+ * Authorization hash for the selected measure.
+ */
+ struct TALER_KycMeasureAuthorizationHashP shv;
+
+ /**
* Index of the measure this upload is for.
*/
unsigned int measure_index;
@@ -290,6 +295,30 @@ transact (void *cls,
break;
}
+ {
+ struct TALER_KycMeasureAuthorizationHashP shv;
+
+ TALER_kyc_measure_authorization_hash (
+ &uc->access_token,
+ uc->legitimization_measure_serial_id,
+ uc->measure_index,
+ &shv);
+ if (0 !=
+ GNUNET_memcmp (&uc->shv,
+ &shv))
+ {
+ GNUNET_break_op (0);
+ GNUNET_free (enc_attributes);
+ json_decref (jmeasures);
+ *mhd_ret = TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_NOT_FOUND,
+ TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
+ rc->url);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
+ }
+
if (NULL != enc_attributes)
{
json_t *xattributes;
@@ -498,15 +527,15 @@ TEH_handler_kyc_upload (
if (GNUNET_OK !=
GNUNET_STRINGS_string_to_data (id,
slash - id,
- &uc->access_token,
- sizeof (uc->access_token)))
+ &uc->shv,
+ sizeof (uc->shv)))
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (
rc->connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "Access token in ID is malformed");
+ "Authorization hash in ID is malformed");
}
if (2 !=
sscanf (slash + 1,
diff --git a/src/exchangedb/insert_aml_decision.c b/src/exchangedb/insert_aml_decision.c
@@ -60,7 +60,7 @@ TALER_EXCHANGEDB_insert_aml_decision (
struct TALER_FullPaytoHashP h_full_payto;
char *notify_s
= GNUNET_PQ_get_event_notify_channel (&rep.header);
- bool account_unknown;
+ bool wallet_unknown;
struct GNUNET_PQ_QueryParam params[] = {
/* $1: in_payto_uri */
NULL == payto_uri.full_payto
@@ -138,7 +138,7 @@ TALER_EXCHANGEDB_insert_aml_decision (
GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_bool ("out_is_wallet",
is_wallet),
- &account_unknown),
+ &wallet_unknown),
GNUNET_PQ_result_spec_end
};
enum GNUNET_DB_QueryStatus qs;
@@ -177,9 +177,11 @@ TALER_EXCHANGEDB_insert_aml_decision (
GNUNET_PQ_event_do_poll (pg->conn);
if (qs <= 0)
return qs;
- if (account_unknown)
+ if (wallet_unknown && (! *invalid_officer) && (! *unknown_account))
{
- GNUNET_assert ((*invalid_officer) || (*unknown_account));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Refusing to decision older than previous decision\n");
+ return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
}
return qs;
}