exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 6c9a0ce92cdf301d045ec48b50149c023a959ed9
parent ae9b97a4392cda62ebdb86b87c388d2b4dcdf54f
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue,  3 Jun 2025 23:05:16 +0200

fix bug in account_pub matching logic for #10044 (bad left-over memset to 0)

Diffstat:
Msrc/exchange/taler-exchange-httpd_kyc-check.c | 5+++--
Msrc/exchangedb/exchange_do_lookup_kyc_requirement_by_row.sql | 22+++++++++++++++++-----
Msrc/exchangedb/pg_lookup_kyc_requirement_by_row.c | 3---
3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c @@ -318,8 +318,9 @@ TEH_handler_kyc_check ( bool do_suspend; GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Looking up KYC requirements for account %s\n", - TALER_B2S (&kyp->h_payto)); + "Looking up KYC requirements for account %s (%s)\n", + TALER_B2S (&kyp->h_payto), + kyp->have_pub ? "with account-pub" : "legacy wallet"); qs = TEH_plugin->lookup_kyc_requirement_by_row ( TEH_plugin->cls, &kyp->h_payto, diff --git a/src/exchangedb/exchange_do_lookup_kyc_requirement_by_row.sql b/src/exchangedb/exchange_do_lookup_kyc_requirement_by_row.sql @@ -45,17 +45,27 @@ SELECT access_token FROM kyc_targets WHERE h_normalized_payto=in_h_normalized_payto; -my_ok = FOUND; +IF NOT FOUND +THEN +-- RAISE WARNING 'kyc_target % not found', in_h_normalized_payto; + out_not_found = TRUE; + out_kyc_required = FALSE; + RETURN; +END IF; + +my_ok = (in_account_pub IS NOT NULL) AND + (my_wtrec.target_pub = in_account_pub); IF ( (NOT my_ok) AND - (in_account_pub IS NOT NULL) AND - (my_wtrec.target_pub!=in_account_pub) ) + (in_account_pub IS NOT NULL) ) THEN +-- RAISE WARNING 'target_pub % does not match', in_account_pub; -- Try to see if the in_account_pub appears in ANY reserve_in -- for this account. PERFORM FROM reserves_in - WHERE wire_source_h_payto IN + WHERE reserve_pub=in_account_pub + AND wire_source_h_payto IN (SELECT wire_target_h_payto FROM wire_targets WHERE h_normalized_payto=in_h_normalized_payto); @@ -66,7 +76,7 @@ THEN END IF; END IF; -IF NOT my_ok +IF (NOT my_ok) THEN out_not_found = TRUE; out_kyc_required = FALSE; @@ -78,6 +88,8 @@ out_is_wallet = my_wtrec.is_wallet; out_account_pub = my_wtrec.target_pub; out_access_token = my_wtrec.access_token; +-- RAISE WARNING 'account_pub established, checking measures for %', out_access_token; + -- Check if there are active measures for the account. PERFORM FROM legitimization_measures diff --git a/src/exchangedb/pg_lookup_kyc_requirement_by_row.c b/src/exchangedb/pg_lookup_kyc_requirement_by_row.c @@ -93,9 +93,6 @@ TEH_PG_lookup_kyc_requirement_by_row ( *aml_review = false; *is_wallet = false; *rule_gen = 0; - memset (account_pub, - 0, - sizeof (*account_pub)); memset (reserve_pub, 0, sizeof (*reserve_pub));