commit 4caa684c78580f6d24f450cacdbea3cef5f47396
parent e1aa1d9d6815765766bde8a4c2955cd9f9587376
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Fri, 17 Jul 2026 19:22:38 +0200
check year matches
Diffstat:
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/donau/donau-httpd_post-batch-submit.c b/src/donau/donau-httpd_post-batch-submit.c
@@ -201,6 +201,25 @@ DH_handler_post_batch_submit (struct DH_RequestContext *rc,
NULL);
}
+ /* The donation unit's validity year must match the year the donor is
+ attributing the receipt to; otherwise a donor could book a receipt
+ under an arbitrary (donor-controlled) tax year. */
+ if (dk->validity_year != irc.donation_year)
+ {
+ char year_str[20];
+
+ GNUNET_break_op (0);
+ GNUNET_snprintf (year_str,
+ sizeof (year_str),
+ "%llu",
+ (unsigned long long) dk->validity_year);
+ free_irc (&irc);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_CONFLICT,
+ TALER_EC_DONAU_GENERIC_DONATION_UNIT_WRONG_YEAR,
+ year_str);
+ }
+
DONAU_unique_donor_id_hash (
&irc.h_donor_tax_id,
&irc.donation_receipts[i].nonce,