donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 112e74e9a43edbf3a5d716eb8005c832e0eea961
parent 31e037a7d6c9d7cbd3eb2f5644c5b5ac0be9b61f
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 26 Sep 2025 14:25:13 +0200

fix #10458

Diffstat:
Maclocal.m4 | 13++-----------
Msrc/donau/donau-httpd_batch-issue.c | 40+++++++++++++++++++++++++++-------------
Msrc/include/donau_service.h | 2+-
Msrc/lib/donau_api_batch_issue_receipts.c | 8+++-----
4 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4 @@ -68,8 +68,8 @@ m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ -dnl PKG_PROG_PKG_CONFIG([MIN-VERSION], [ACTION-IF-NOT-FOUND]) -dnl --------------------------------------------------------- +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to @@ -77,12 +77,6 @@ dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. -dnl -dnl If pkg-config is not found or older than specified, it will result -dnl in an empty PKG_CONFIG variable. To avoid widespread issues with -dnl scripts not checking it, ACTION-IF-NOT-FOUND defaults to aborting. -dnl You can specify [PKG_CONFIG=false] as an action instead, which would -dnl result in pkg-config tests failing, but no bogus error messages. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) @@ -103,9 +97,6 @@ if test -n "$PKG_CONFIG"; then AC_MSG_RESULT([no]) PKG_CONFIG="" fi -fi -if test -z "$PKG_CONFIG"; then - m4_default([$2], [AC_MSG_ERROR([pkg-config not found])]) fi[]dnl ])dnl PKG_PROG_PKG_CONFIG diff --git a/src/donau/donau-httpd_batch-issue.c b/src/donau/donau-httpd_batch-issue.c @@ -128,7 +128,6 @@ DH_handler_issue_receipts_post (struct DH_RequestContext *rc, "issue receipts for charity id: %llu\n", charity_id); - { struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_array_const ("budikeypairs", @@ -243,14 +242,29 @@ DH_handler_issue_receipts_post (struct DH_RequestContext *rc, hc = GNUNET_CRYPTO_hash_context_start (); for (size_t i = 0; i < num_bkps; i++) { + const struct GNUNET_CRYPTO_BlindedMessage *bm + = bkps[i].blinded_udi.blinded_message; + GNUNET_CRYPTO_hash_context_read (hc, &bkps[i].h_donation_unit_pub, sizeof (bkps[i].h_donation_unit_pub)); - // FIXME: sizeof on blinded_message? seems VERY wrong! - GNUNET_CRYPTO_hash_context_read ( - hc, - bkps[i].blinded_udi.blinded_message, - sizeof (bkps[i].blinded_udi.blinded_message)); + switch (bm->cipher) + { + case GNUNET_CRYPTO_BSA_INVALID: + GNUNET_assert (0); + case GNUNET_CRYPTO_BSA_CS: + GNUNET_CRYPTO_hash_context_read ( + hc, + &bm->details.cs_blinded_message, + sizeof (bm->details.cs_blinded_message)); + break; + case GNUNET_CRYPTO_BSA_RSA: + GNUNET_CRYPTO_hash_context_read ( + hc, + bm->details.rsa_blinded_message.blinded_msg, + bm->details.rsa_blinded_message.blinded_msg_size); + break; + } } GNUNET_CRYPTO_hash_context_read (hc, &charity_sig, @@ -278,7 +292,7 @@ start: case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: GNUNET_log (GNUNET_ERROR_TYPE_INFO, "request has not been made yet (first time)!\n"); - break; // it's the first request from the charity, we can proceed + break; /* it's the first request from the charity, we can proceed */ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: GNUNET_log (GNUNET_ERROR_TYPE_INFO, "request has been made already!\n"); @@ -288,6 +302,8 @@ start: return TALER_MHD_REPLY_JSON_PACK ( rc->connection, MHD_HTTP_OK, + TALER_JSON_pack_amount ("issued_amount", + &check_receipts_meta.amount), GNUNET_JSON_pack_array_steal ("blind_signatures", blind_signatures)); } @@ -389,13 +405,11 @@ start: } return TALER_MHD_REPLY_JSON_PACK ( rc->connection, - MHD_HTTP_CREATED, - GNUNET_JSON_pack_uint64 ("num_blind_signatures", - (uint64_t) num_bkps), - GNUNET_JSON_pack_array_steal ("blind_signatures", - blind_signatures), + MHD_HTTP_OK, TALER_JSON_pack_amount ("issued_amount", - &receipts_sum)); + &receipts_sum), + GNUNET_JSON_pack_array_steal ("blind_signatures", + blind_signatures)); } diff --git a/src/include/donau_service.h b/src/include/donau_service.h @@ -1059,7 +1059,7 @@ struct DONAU_Charity /** * charity url - */ + */ const char *charity_url; /** diff --git a/src/lib/donau_api_batch_issue_receipts.c b/src/lib/donau_api_batch_issue_receipts.c @@ -98,8 +98,6 @@ handle_batch_issue_ok (const json_t *resp_obj, struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_amount_any ("issued_amount", &biresp->details.ok.issued_amount), - GNUNET_JSON_spec_uint64 ("num_blind_signatures", - &biresp->details.ok.num_blinded_sigs), GNUNET_JSON_spec_array_const ("blind_signatures", &j_blind_signatures), GNUNET_JSON_spec_end () @@ -115,12 +113,13 @@ handle_batch_issue_ok (const json_t *resp_obj, return GNUNET_SYSERR; } if ( (NULL == j_blind_signatures) || - (! json_is_array (j_blind_signatures)) || - (birh->num_blinded_sigs != json_array_size (j_blind_signatures)) ) + (! json_is_array (j_blind_signatures)) ) { GNUNET_break (0); return GNUNET_SYSERR; } + biresp->details.ok.num_blinded_sigs + = json_array_size (j_blind_signatures); biresp->details.ok.blinded_sigs = GNUNET_new_array (birh->num_blinded_sigs, struct DONAU_BlindedDonationUnitSignature); @@ -220,7 +219,6 @@ handle_batch_issue_finished (void *cls, switch (response_code) { case MHD_HTTP_OK: - case MHD_HTTP_CREATED: if (GNUNET_OK != handle_batch_issue_ok (j, birh,